Helpers
Generic object and path helpers — the small building blocks the hooks and utilities in this package are made of: reading, writing and picking dot paths, deep equality, and a few type checks. They cover what a Feathers app usually pulls in lodash for, with semantics tuned for Feathers: writes never leak into a caller's params, and comparisons understand symbol operators and ObjectIds.
import { getPath, setPath, pickPaths, isEqual } from 'feathers-utils/helpers'| Utility | Description |
|---|---|
getPath | Reads the value at A path is a dot/bracket string ( |
hasPath | Whether |
isEmptyObject | Returns |
isEqual | Deep equality for the values a Feathers app passes around — data, results,
queries and params. Plain objects are compared by their own enumerable keys
in any order (symbols included - sequelize uses them as operators), arrays by
their elements, dates and regular expressions by value, a mongo It never mistakes different values for equal, but may miss equal ones (two
distinct |
isPlainObject | Type guard for a plain object — one whose prototype is |
isPromise | Type guard that checks if a value is a native |
omitPaths | Returns a copy of Each entry of |
pickPaths | Returns an object holding only the given paths of Each entry of |
setPath | Writes
Missing segments are created as an array when the next key is an integer
index, otherwise as a plain object. Paths through |
toArray | Normalizes a value or array into an array. The returned array MUST be treated as read-only — when the input is already an array it is returned as-is (no copy) to avoid a per-call allocation on hook hot paths. |
