diff options
Diffstat (limited to 'src/ClientUtils.ts')
-rw-r--r-- | src/ClientUtils.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ClientUtils.ts b/src/ClientUtils.ts index e5dbb81db..8c9dd0a32 100644 --- a/src/ClientUtils.ts +++ b/src/ClientUtils.ts @@ -365,6 +365,15 @@ export namespace ClientUtils { } } +/** + * Removes specified keys from an object and returns the result in the 'omit' field of the return value. + * The keys that were removed ared retuned in the 'extract' field of the return value. + * @param obj - object to remove keys from + * @param keys - list of key field names to remove + * @param pattern - optional pattern to specify keys to removed + * @param addKeyFunc - optional function to call with object after keys have been removed + * @returns a tuple object containint 'omit' (oject after keys have been removed) and 'extact' (object containing omitted fields) + */ export function OmitKeys(obj: object, keys: string[], pattern?: string, addKeyFunc?: (dup: object) => void): { omit: { [key: string]: unknown }; extract: { [key: string]: unknown } } { const omit: { [key: string]: unknown } = { ...obj }; const extract: { [key: string]: unknown } = {}; |