Namespace: reduce

just.reduce(object, fn, accumulator, thisArg)

Same as Array.prototype.reduce, but for the own enumerable properties of object, and with an extra param (thisArg).
Source:
just.js, line 130

Parameters:

NameTypeDescription
object
objectThe target object.
fn
functionThe transform function. It's called with the same arguments as the Array.prototype.reduce function.
accumulator
AnyThe initial value for the accumulator.
thisArg
Anythis argument for fn.

Returns:

accumulator

Example

Example 1: Get object keys (when Object.keys is unavailable).
just.reduce({'a': 1}, function (keys, value, key, object) { return keys.concat(key); }, []);
// > ['a']