Package Exports
- @jumpn/utils-composite
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jumpn/utils-composite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@jumpn/utils-composite
Composite utilities (immutability, fp helpers)
NOTE: All the functions described in API are curried
Types
type Composite = Array<*> | Object;
type Key = number | string;
type Path = Array<Key>;
API
get
Get property value of given key.
Parameters
key
Keycomposite
Composite
getIn
Returns value located at the given path or undefined otherwise.
Parameters
path
Pathcomposite
Composite
getKeys
Get own enumerable keys.
Parameters
composite
Composite
Returns Array<Key>
hasIn
Returns true if value located at given path is strictly equal to the one specified.
Parameters
path
Pathvalue
anycomposite
Composite
hasKey
Returns true if key is included in composite's own enumerable ones, or false otherwise.
Parameters
key
Keycomposite
Composite
haveSameProps
Returns true if both composites have the same props or false otherwise.
Parameters
c1
Compositec2
Composite
remove
Returns a new composite with the result of having removed the property with the given key.
Parameters
key
Keycomposite
Composite
removeIn
Returns a new composite with the result of having removed the property located at the given path.
(This does the same as calling updateIn with updater:
() => updateIn.remove
)
Parameters
path
Pathcomposite
Composite
set
Returns a new composite with the result of having updated the property with the given key with the specified value.
Parameters
key
Keyvalue
anycomposite
Composite
setIn
Returns a new composite with the result of having updated the property located at the given path with the specified value.
(This does the same as calling updateIn with updater: () => value
)
Parameters
path
Pathvalue
anycomposite
Composite
shallowCopy
Returns a new composite with the same own enumerable props of the one given.
Parameters
composite
Composite
shallowEqual
Returns true if both composites are of the same type (Array or Object) and their properties are strictly equal.
Parameters
c1
Compositec2
Composite
updateIn
Returns a new composite with the result of having updated the property value at the given path with the result of the call to updater function.
Entry removal is supported by returning updateIn.remove
symbol on updater
function.
Parameters
path
Pathupdater
function (prev: any): anycomposite
Composite
License
MIT ©️ Jumpn Limited / Mauro Titimoli (mauro@jumpn.com)