Skip to content

Object Helpers

Utility functions for working with object operations.

FunctionDescription
compactRemoves all entries with falsy values (false, null, undefined, 0, "", NaN) from an object.
deepCloneCreates a deep copy of an object or array
deepCompareDeep comparison of two objects that returns detailed information about differences.
deepMergeMerges two or more objects deeply
getGets a value from an object using a dot-notated path
hasnative JS Object.hasOwn(obj, key) (ES2022)
keys / valuesnative JS Object.keys() / Object.values() (ES2017)
merge (shallow)native JS { ...a, ...b } or Object.assign({}, a, b) (ES2015)
omitCreates a new object without the specified keys.
pickCreates a new object with only the specified keys.
removeUndefinedNullRemove null and undefined values from an object.
safeJsonParseParses a JSON string, returning null (or a fallback) on any parse failure.
setSets a value in an object using a dot-notated path
shallowEqualsQuick comparison of two objects using JSON.stringify.
toPairs / fromPairsnative JS Object.entries() / Object.fromEntries() (ES2019)