Skip to main content

core.subtract

Home > @medplum/core > subtract

subtract() function

List the keys in minuend that are not in subtrahend.

A key is only considered if it is both 1) an own-property (o.hasOwnProperty(k)) of the object, and 2) has a value that is not undefined. This is to match JSON semantics, where JSON object serialization drops keys with undefined values.

Signature:

export declare function subtract(minuend: {
[index: string]: any;
}, subtrahend: {
[index: string]: any;
}): string[];

Parameters

Parameter

Type

Description

minuend

{ [index: string]: any; }

Object of interest

subtrahend

{ [index: string]: any; }

Object of comparison

Returns:

string[]

Array of keys that are in minuend but not in subtrahend.