Given an object, returns a new object, where each property is transformed by the callback function
Given an array, and an item, if the item is found in the array, it removes it (in-place). The same array is returned
shallow copy from src to dest
Naive forEach implementation works with Objects or Arrays
Naive forEach implementation works with Objects or Arrays
Reduce function that returns true if all of the values are truthy.
Reduce function that returns true if all of the values are truthy.
Finds the common ancestor path between two states.
Reduce function that returns true if any of the values are truthy.
Reduce function that returns true if any of the values are truthy.
let vals = [ 0, null, undefined ]; vals.reduce(anyTrueR, true); // false
vals.push("hello world"); vals.reduce(anyTrueR, true); // true ```
Reduce function which builds an object from an array of [key, value] pairs.
Reduce function which builds an object from an array of [key, value] pairs.
Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.
Each keyValueTuple should be an array with values [ key: string, value: any ]
Given two or more parallel arrays, returns an array of tuples where each tuple is composed of [ a[i], b[i], ... z[i] ]
Given two or more parallel arrays, returns an array of tuples where each tuple is composed of [ a[i], b[i], ... z[i] ]
Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.
Binds and copies functions onto an object
Binds and copies functions onto an object
Takes functions from the 'from' object, binds those functions to the _this object, and puts the bound functions on the 'to' object.
This example creates an new class instance whose functions are prebound to the new'd object.
The object which contains the functions to be bound
The object which will receive the bound functions
The object which the functions will be bound to
The function names which will be bound (Defaults to all the functions found on the 'from' object)
Applies a set of defaults to an options object. The options object is filtered to only those properties of the objects in the defaultsList. Earlier objects in the defaultsList take precedence when applying defaults.
Applies a set of defaults to an options object. The options object is filtered to only those properties of the objects in the defaultsList. Earlier objects in the defaultsList take precedence when applying defaults.
Performs a non-strict comparison of the subset of two objects, defined by a list of keys.
Performs a non-strict comparison of the subset of two objects, defined by a list of keys.
The first object.
The second object.
The list of keys within each object to compare. If the list is empty or not specified,
it defaults to the list of keys in a
.
Returns true
if the keys match, otherwise false
.
Given an array of objects, returns a new array containing only the elements which passed the callback predicate
Given an object, returns a new object with only those properties that passed the callback predicate
Given an array of objects, returns a new array containing only the elements which passed the callback predicate
Given an object, returns a new object with only those properties that passed the callback predicate
Given an object, return the first property of that object which passed the callback predicate
Given an array of objects, returns the first object which passed the callback predicate
Given an object, return the first property of that object which passed the callback predicate
Given an array of objects, returns the first object which passed the callback predicate
Return a completely flattened version of an array.
Return a completely flattened version of an array.
Reduce function which recursively un-nests all arrays
Reduce function which recursively un-nests all arrays
Given an array, returns true if the object is found in the array, (using indexOf)
Given an array, returns true if the object is found in the array, (using indexOf)
prototypal inheritance helper.
Creates a new object which has parent
object as its prototype, and then copies the properties from extra
onto it
Given an array, returns a new array, where each element is transformed by the callback function
Maps an array or object properties using a callback function
Given an array, returns a new array, where each element is transformed by the callback function
Maps an array or object properties using a callback function
Merges properties from the list of objects to the destination object. If a property already exists in the destination object, then it is not overwritten.
Reduce function that merges each element of the list into a single object, using extend
Return a copy of the object omitting the blacklisted properties.
Return a copy of the object omitting the blacklisted properties.
Return a copy of the object omitting the blacklisted properties.
the source object
an Array of strings, which are the blacklisted property names
Return a copy of the object omitting the blacklisted properties.
the source object
1..n strings, which are the blacklisted property names
Like _.pairs: Given an object, returns an array of key/value pairs
Like _.pairs: Given an object, returns an array of key/value pairs
Return a copy of the object only containing the whitelisted properties.
Return a copy of the object only containing the whitelisted properties.
Return a copy of the object only containing the whitelisted properties.
the source object
an Array of strings, which are the whitelisted property names
Return a copy of the object only containing the whitelisted properties.
the source object
1..n strings, which are the whitelisted property names
Given an array of objects, maps each element to a named property of the element.
Given an object, maps each property of the object to a named property of the property.
Given an array of objects, maps each element to a named property of the element.
Given an object, maps each property of the object to a named property of the property.
Reduce function that pushes an object to an array, then returns the array. Mostly just for flattenR and uniqR
Given an arguments object, converts the arguments at index idx and above to an array. This is similar to es6 rest parameters.
Given an arguments object, converts the arguments at index idx and above to an array. This is similar to es6 rest parameters.
Optionally, the argument at index idx may itself already be an array.
For example, given either: arguments = [ obj, "foo", "bar" ] or: arguments = [ obj, ["foo", "bar"] ] then: restArgs(arguments, 1) == ["foo", "bar"]
This allows functions like pick() to be implemented such that it allows either a bunch of string arguments (like es6 rest parameters), or a single array of strings:
given: var obj = { foo: 1, bar: 2, baz: 3 }; then: pick(obj, "foo", "bar"); // returns { foo: 1, bar: 2 } pick(obj, ["foo", "bar"]); // returns { foo: 1, bar: 2 }
Get the last element of an array
Get the last element of an array
Reduce function that filters out duplicates
Reduce function that filters out duplicates
Return a new array with a single level of arrays unnested.
Return a new array with a single level of arrays unnested.
Reduce function which un-nests a single level of arrays
Reduce function which un-nests a single level of arrays
Given an object, return its enumerable property values
Given an object, return its enumerable property values
Generated using TypeDoc
Random utility functions used in the UI-Router code