crio API
Instantiation
- crio
{any}
, returns CrioArray|CrioObject- Standard method, will
crio
the object passed if an array or object, else it will return the object itself
- Standard method, will
- crio.array
{Array<any>}
, returns CrioArray- Shortcut method for
crio
ing array-specific values
- Shortcut method for
- crio.object
{Object}
, returns CrioObject- Shortcut method for
crio
ing object-specific values
- Shortcut method for
- crio.isCrio
{any}
, returns boolean- Determine if the object passed is a
Crio
- Determine if the object passed is a
- crio.isArray
{any}
, returns boolean- Determine if the object passed is a
CrioArray
- Determine if the object passed is a
- crio.isObject
{any}
, returns boolean- Determine if the object passed is a
CrioObject
- Determine if the object passed is a
Methods with the same name as the native method will be a link to MDN, as they are meant to be as similar to the native method as possible. Where any specific differences from the default behavior exist, they will be called out, however one broad difference is that all methods that are not getters which return primitive values are chainable.
Shared Methods
The following methods are specific to Crio
types, and are available on either CrioArray
or CrioObject
- clear, returns
{CrioArray|CrioObject}
- returns an empty
Crio
- returns an empty
- compact, returns
{CrioArray|CrioObject}
- returns a new
Crio
with all falsy values filtered out
- returns a new
- delete
{number}
key, returns{CrioArray|CrioObject}
- Deletes the key provided from the crio object
- deleteIn
{Array<number|string>}
keys, returns{CrioArray|CrioObject}
- Deletes the final key based on the array of keys nested inside of the crio object
- equals
{CrioArray|CrioObject}
crioArrayToCompare, returns{boolean}
- Determines whether array is deeply equal in value to another by comparing hashCodes
- get
{number}
key, returns{any}
- Retrieve value at key
- getIn
{Array<number|string>}
keys, returns{any}
- Retrieve value in deeply nested object based on array of keys
- has
{string}
key, returns{boolean}
- Alias for
hasOwnProperty
- Alias for
- hasIn
{Array<number|string>}
keys, returns{boolean}
- Does the
Crio
have the combination of keys assigned deeply
- Does the
- merge
{Object[, Object2, ..., ObjectN]}
objects, returns{CrioArray|CrioObject}
- Shallow merge any number of items into existing crio
- mergeIn
{Array<number|string>}
keys,{Object[, Object2, ..., ObjectN]}
objects, returns{CrioArray|CrioObject}
- Shallow merge any number of items into value existing in deeply nested object based on array of keys
- mutate
{function(mutableCrio, originalCrio): any}
callback, returns{CrioArray|CrioObject}
- Whatever you return in the callback is what is returned, or if you return nothing it returns the original
Crio
- Whatever you return in the callback is what is returned, or if you return nothing it returns the original
- pluck
{number|string}
key, returns{CrioArray|CrioObject}
- Iterates over
Crio
and returns an array of values where the key exists as a property on the collection item
- Iterates over
- pluckIn
{Array<number|string}
keys, returns{CrioArray|CrioObject}
- Iterates over
Crio
and returns an array of values where the keys map to a deeply-nested property on the collection item
- Iterates over
- set
{number}
key, returns{CrioArray|CrioObject}
- Sets value at key
- setIn
{Array<number|string>}
keys, returns{CrioArray|CrioObject}
- Sets value in deeply nested object based on array of keys
- toArray, returns
{CrioArray}
- Converts
CrioObject
to aCrioArray
of the object's values
- Converts
- toObject, returns
{CrioObject}
- Converts
CrioArray
into aCrioObject
of index: value pairs
- Converts
- thaw, returns
{Array<any>}
- Recursively thaws array deeply and returns standard object version of itself
Arrays
Default Methods
- concat
- copyWithin
- entries
- every
- fill
- Returns new crio with items from start to end filled with value
- filter
- find
- findIndex
- forEach
- includes
- Does a deep value equality comparison (rather than strict equality), so you can do things like
crioArray.includes({foo: 'bar'})
- Does a deep value equality comparison (rather than strict equality), so you can do things like
- indexOf
- join
- keys
- lastIndexOf
- map
- pop
- Returns new crio with first item removed
- push
- Returns new crio with new item added
- reduce
- reduceRight
- reverse
- shift
- Returns new crio with last item removed
- slice
- some
- sort
- Returns new crio sorted by either callback or default
- splice
- Returns new crio with items added/removed based on splicing parameters
- toLocaleString
- toString
- unshift
- Returns new crio with new items added to beginning
- values
Added crio Methods
- difference
{Array<*>}
array[, array2, ..., arrayN], returns{CrioArray}
- Returns a new array of the values that only exist in either the
CrioArray
or in one of the arrays passed
- Returns a new array of the values that only exist in either the
- findLastIndex
{function}
fn, returns{number}
- Same as
findIndex
but starting from end and working to start
- Same as
- first
{number}
num, returns{CrioArray}
- Returns a new array of the first num number of items in the array
- intersection
{Array<*>}
array[, array2, ..., arrayN], returns{CrioArray}
- Returns a new array of the values that exist in all of the arrays passed
- last
{number}
num, returns{CrioArray}
- Returns a new array of the last num number of items in the array
- unique, returns
{CrioArray}
- Returns a new
CrioArray
of values filtered down to only existing in the array once
- Returns a new
- xor
{Array<*>}
array[, array2, ..., arrayN], returns{CrioArray}
- Returns a new array of the values that are the symmetric difference of the
CrioArray
and the arrays passed
- Returns a new array of the values that are the symmetric difference of the
Objects
Default Methods
Added crio Methods
- entries, returns
{Array<[string, any]>}
- Gets an array of the
[key, value]
pairs in theCrioObject
- Gets an array of the
- every
{function(value, key, CrioObject): any}
fn,{any}
thisArg, returns{any}
- Performs same function as
every
in theArray
prototype, but on theCrioObject
- Performs same function as
- forEach
{function}
fn,{any}
thisArg, returns{CrioObject}
- Iterates over object executing fn
- Iteration order is not guaranteed
- filter
{function}
fn,{any}
thisArg, returns{CrioObject}
- Iterates over object and filters out any returned values that are falsy
- Iteration order is not guaranteed
- findKey
{function}
fn, returns{number}
- Same as
findIndex
forCrioArray
but finding the key instead of the index
- Same as
- findLastKey
{function}
fn, returns{number}
- Same as
findKey
but starting from end and working to start
- Same as
- includes
{any}
value, returns{boolean}
- Determine if the
CrioObject
has a value that deeply matchesvalue
in equality
- Determine if the
- keys, returns
{Array<string>}
- Returns an array of the keys in the
CrioObject
- Returns an array of the keys in the
- map
{function}
fn,{any}
thisArg, returns{CrioObject}
- Iterates over object and maps returned value to the respective key
- Iteration order is not guaranteed
- reduce
{function(accumulatedObject, value, key): any}
fn,{any}
thisArg, returns{any}
- Performs same function as
reduce
in theArray
prototype, but on theCrioObject
- Performs same function as
- reduceRight
{function(accumulatedObject, value, key): any}
fn,{any}
thisArg, returns{any}
- Performs same function as
reduceRight
in theArray
prototype, but on theCrioObject
- Performs same function as
- some
{function(value, key, CrioObject): any}
fn,{any}
thisArg, returns{any}
- Performs same function as
some
in theArray
prototype, but on theCrioObject
- Performs same function as
- values, returns
{Array<any>}
- Returns an array of the values in the
CrioObject
- Returns an array of the values in the