1.0.0 • Published 11 years ago
array-reduce-right v1.0.0
array-reduce-right
Array#reduceRight ponyfill for older browsers
Ponyfill: A polyfill that doesn't overwrite the native method
DESCRIPTION
Provides reduceRight function for older browsers, use native implememtation if exists.
It's just like
EXAMPLE
var total = reduceRight([3, 2, 24], function (a, b) {
return a / b;
});
assert.equal(total, 4);
var flattened = reduceRight([[0, 1], [2, 3], [4, 5]], function (a, b) {
return a.concat(b);
}, []);
assert.deepEqual(flattened, [4, 5, 2, 3, 0, 1]);INSTALL
via npm
Install
$ npm install --save array-reduce-rightUse
var reduceRight = require('array-reduce-right');use array-reduce-right npm module on browser
reduceRight function is exported
<script type="text/javascript" src="./path/to/node_modules/array-reduce-right/build/array-reduce-right.js"></script>via bower
Install
$ bower install --save array-reduce-rightLoad (reduceRight function is exported)
<script type="text/javascript" src="./path/to/bower_components/array-reduce-right/build/array-reduce-right.js"></script>Use
var total = reduceRight([3, 2, 24], function (a, b) {
return a / b;
});AUTHOR
LICENSE
Licensed under the MIT license.
1.0.0
11 years ago