Skip to content
Adam Smith edited this page Mar 3, 2016 · 9 revisions

vitals.roll npm version

Method Section Alias
roll base
roll.up base
roll.down base

roll

A shortcut for deriving a result by iterating over object maps, arrays, or cycles.

Examples

Params

  1. base *=
If defined it is the base value. Note that for number sources (i.e. cycles) a base is required.
  1. source !(Object|function|Array|number)
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.
  1. iteratee function(*=, *=, (string|number)=, !(Object|function)=)

    It has the optional params - previousValue, currentValue, key/index, and source. Note this method lazily clones the source based on the iteratee's length property (i.e. if you alter the source object within the iteratee ensure to define the iteratee's fourth param so you can safely assume all references to the source are its original values).

  2. thisArg Object=

If defined the iteratee is bound to this value.

Returns *

roll.up

A shortcut for deriving a sum by iterating over object maps, arrays, or cycles.

Examples

Params

  1. base *=
If defined it is the base value. Note that for number sources (i.e. cycles) a base is required.
  1. source !(Object|function|Array|number)
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.
  1. 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).
  1. thisArg Object=
If defined the iteratee is bound to this value.

Returns *

roll.down

A shortcut for deriving a difference by iterating over object maps, arrays, or cycles.

Examples

Params

  1. base *=
If defined it is the base value. Note that for number sources (i.e. cycles) a base is required.
  1. source !(Object|function|Array|number)
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.
  1. 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).
  1. thisArg Object=
If defined the iteratee is bound to this value.

Returns *

-- Happy Developing,

Algorithm IV Logo

Clone this wiki locally