Add isNotEmpty for objects

This commit is contained in:
Iván Ovejero 2023-01-20 09:36:25 +01:00
parent 4ddf260afd
commit 8264fcb795

View File

@ -21,6 +21,10 @@ function isEmpty(value: object): boolean {
return Object.keys(value).length === 0;
}
function isNotEmpty(value: object): boolean {
return !isEmpty(value);
}
function hasField(value: object, extraArgs: string[]): boolean {
const [name] = extraArgs;
return name in value;
@ -93,6 +97,7 @@ export const objectExtensions: ExtensionMap = {
typeName: 'Object',
functions: {
isEmpty,
isNotEmpty,
merge,
hasField,
removeField,