Skip to content

Object Helpers

Utility functions for working with object operations.

FunctionDescription
camelCaseKeysRecursively transforms every key of a plain object (including keys nested inside arrays and nested objects) to camelC…
cloneCreates a shallow copy of a value — one level deep, unlike cloneDeep.
cloneDeepCreates a deep copy of an object or array.
compactRemoves all entries with falsy values (`false`, `null`, `undefined`, `0`, `""`, `NaN`) from an object.
diffStructural object diff.
equalsDeepRecursive structural object equality.
equalsShallowOne-level (shallow) object equality.
flattenFlattens a nested object into a single-level object whose keys are the dot-notation path to each leaf value.
getGets a value from an object using a dot/bracket-notated path or explicit key array.
groupByGroups an array of items by a key derived from each item.
hasnative JS Object.hasOwn(obj, key) (ES2022)
invertReturns a new object with keys and values swapped.
isEmptyChecks if a plain object has no own enumerable string-keyed properties.
isNonEmptyChecks if a plain object has at least one own enumerable string-keyed property.
kebabCaseKeysRecursively transforms every key of a plain object (including keys nested inside arrays and nested objects) to kebab-…
keys / valuesnative JS Object.keys() / Object.values() (ES2017)
mapTransforms the values and/or keys of a plain object in a single pass.
mapDeepRecursively transforms the keys and/or values of a plain object — the deep counterpart to map, which only transforms …
merge (shallow)native JS { ...a, ...b } or Object.assign({}, a, b) (ES2015)
mergeDeepMerges two or more objects deeply, returning a **new** object without mutating any input.
omitCreates a new object without the specified keys.
omitByCreates a new object without the own enumerable entries for which `predicate` returns `true`.
parsePropertyPathParses a dot/bracket-notation property path into an array of string/number key segments — the same notation accepted …
pascalCaseKeysRecursively transforms every key of a plain object (including keys nested inside arrays and nested objects) to Pascal…
pickCreates a new object with only the specified keys.
pickByCreates a new object with only the own enumerable entries for which `predicate` returns `true`.
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 at the given path, creating intermediate objects as needed.
snakeCaseKeysRecursively transforms every key of a plain object (including keys nested inside arrays and nested objects) to snake_…
sortKeysCreates a new object with the same entries as the input, but with its own keys sorted.
titleCaseKeysRecursively transforms every key of a plain object (including keys nested inside arrays and nested objects) to Title …
toPairs / fromPairsnative JS Object.entries() / Object.fromEntries() (ES2019)
unflattenRebuilds a nested object from a single-level object whose keys are dot-notation paths.
unsetRemoves the value at a dot/bracket-notation path or explicit key array, mutating the object in place.
updateUpdates the value at a path by applying a function to its current value, creating intermediate objects as needed.