Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object-loops

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-loops - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

2

package.json
{
"name": "object-loops",
"version": "0.3.0",
"version": "0.3.1",
"description": "Functional methods like forEach, map, filter, and other ES5 Array methods for Objects in javascript",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,3 +20,5 @@ 'use strict';

if (Array.isArray(obj)) {
return obj.reduce(callback, initialValue);
return (arguments.length > 2) ?
obj.reduce(callback, initialValue) :
obj.reduce(callback);
}

@@ -23,0 +25,0 @@ if (!isObject(obj)) {

@@ -148,9 +148,17 @@ var Code = require('code');

var callback = sum;
expect(reduce(arr, callback, arr))
.to.equal(arr.reduce(callback, arr));
sinon.assert.calledWith(Array.prototype.reduce, callback, arr);
expect(reduce(arr, callback, 20))
.to.equal(arr.reduce(callback, 20));
sinon.assert.calledWith(Array.prototype.reduce, callback, 20);
done();
});
it('should use array reduce w/out initialValue', function (done) {
var arr = [1,2,3];
var callback = sum;
expect(reduce(arr, callback))
.to.equal(arr.reduce(callback));
sinon.assert.calledWith(Array.prototype.reduce, callback);
done();
});
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc