-
Notifications
You must be signed in to change notification settings - Fork 1
vitals.each
Adam Smith edited this page Mar 3, 2016
·
10 revisions
Method | Section | Alias |
---|---|---|
each | base | |
each.object | base | each.obj |
each.array | base | each.arr |
each.cycle | base | each.time |
A shortcut for iterating over object maps, arrays, or cycles.
Params
-
source
!(Object|function|Array|number|string)
Details per type:
- object source: Iterates over all properties in random order.
- array source: Iterates over all indexed properties from 0 to length.
- number source: Iterates over all cycles.
- string source: Converted to an array source using one of the following list of values for the separator (values listed in order of rank):
- `", "`
- `","`
- `"|"`
- `" "`
-
iteratee
function(*=, (string|number)=, !(Object|function)=)
It has the optional params - value, key/index, source. Note this method lazily clones the source based on the iteratee's [length property](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/length) (i.e. if you alter the source object within the iteratee ensure to define the iteratee's third param so you can safely assume all references to the source are its original values).
-
thisArg
Object=
If defined the iteratee is bound to this value.
Returns (Object|function|Array|undefined)
A shortcut for iterating over object maps.
Params
-
source
!(Object|function)
-
iteratee
function(*=, string=, !(Object|function)=)
The iteratee must be a function with the optional params - value, key, source. Note this method lazily clones the source based on the iteratee's [length property](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/length) (i.e. if you alter the source object within the iteratee ensure to define the iteratee's third param so you can safely assume all references to the source are its original values).
-
thisArg
Object=
If defined the iteratee is bound to this value.
Returns !(Object|function)
A shortcut for iterating over array-like objects.
Params
-
source
!(Object|function|string)
If source is a string it is converted to an array using one of the following list of values for the separator (values listed in order of rank):
- `", "`
- `","`
- `"|"`
- `" "`
-
iteratee
function(*=, number=, !Array=)
The iteratee must be a function with the optional params - value, index, source. Note this method lazily slices the source based on the iteratee's [length property](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/length) (i.e. if you alter the source object within the iteratee ensure to define the iteratee's third param so you can safely assume all references to the source are its original values).
-
thisArg
Object=
If defined the iteratee is bound to this value.
Returns !(Object|function|Array)
A shortcut for iterating over a set number of cycles.
Params
-
count
number
-
iteratee
function(number=)
-
thisArg
Object=
If defined the iteratee is bound to this value.
Returns undefined
-- Happy Developing,