Object Helpers
Utility functions for working with object operations.
Functions
Section titled “Functions”| Function | Description |
|---|---|
compact | Removes all entries with falsy values (false, null, undefined, 0, "", NaN) from an object. |
deepClone | Creates a deep copy of an object or array |
deepCompare | Deep comparison of two objects that returns detailed information about differences. |
deepMerge | Merges two or more objects deeply |
get | Gets a value from an object using a dot-notated path |
has | native JS Object.hasOwn(obj, key) (ES2022) |
keys / values | native JS Object.keys() / Object.values() (ES2017) |
merge (shallow) | native JS { ...a, ...b } or Object.assign({}, a, b) (ES2015) |
omit | Creates a new object without the specified keys. |
pick | Creates a new object with only the specified keys. |
removeUndefinedNull | Remove null and undefined values from an object. |
safeJsonParse | Parses a JSON string, returning null (or a fallback) on any parse failure. |
set | Sets a value in an object using a dot-notated path |
shallowEquals | Quick comparison of two objects using JSON.stringify. |
toPairs / fromPairs | native JS Object.entries() / Object.fromEntries() (ES2019) |