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.5.0 to 0.5.1

4

chain.js

@@ -14,4 +14,4 @@ /**

}
if (typeof obj !== 'object') {
throw new TypeError('obj must be an object')
if (!(obj instanceof Object)) {
throw new TypeError(obj + ' must be an object')
}

@@ -18,0 +18,0 @@ this.obj = obj

/**
* @module object-loops/every
*/
var isObject = require('101/is-object')

@@ -20,7 +19,7 @@ /**

}
if (!isObject(obj)) {
throw new TypeError(obj + ' is not an object')
if (!(obj instanceof Object)) {
throw new TypeError(obj + ' must be an object')
}
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function')
throw new TypeError(callback + ' must be a function')
}

@@ -27,0 +26,0 @@ var ret = true

@@ -21,3 +21,3 @@ /**

if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function')
throw new TypeError(callback + ' must be a function')
}

@@ -24,0 +24,0 @@ var filteredObj = {}

/**
* @module object-loops/for-each
*/
var isObject = require('101/is-object')
/**

@@ -18,7 +18,7 @@ * Executes a provided function once per each object value.

}
if (!isObject(obj)) {
throw new TypeError(obj + ' is not an object')
if (!(obj instanceof Object)) {
throw new TypeError(obj + ' must be an object')
}
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function')
throw new TypeError(callback + ' must be a function')
}

@@ -25,0 +25,0 @@ Object.keys(obj).forEach(function (key) {

@@ -18,3 +18,3 @@ /**

if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function')
throw new TypeError(callback + ' must be a function')
}

@@ -21,0 +21,0 @@ var objIsArray = Array.isArray(obj)

@@ -21,3 +21,3 @@ /**

if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function')
throw new TypeError(callback + ' must be a function')
}

@@ -24,0 +24,0 @@ var mappedObj = {}

{
"name": "object-loops",
"version": "0.5.0",
"version": "0.5.1",
"description": "Functional methods like forEach, map, filter, and other ES5 Array methods for Objects in javascript",

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

/**
* @module object-loops/reduce
*/
var isObject = require('101/is-object')

@@ -22,7 +21,7 @@ /**

}
if (!isObject(obj)) {
throw new TypeError(obj + ' is not an object')
if (!(obj instanceof Object)) {
throw new TypeError(obj + ' must be an object')
}
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function')
throw new TypeError(callback + ' must be a function')
}

@@ -29,0 +28,0 @@ var keys = Object.keys(obj)

/**
* @module object-loops/some
*/
var isObject = require('101/is-object')

@@ -20,7 +19,7 @@ /**

}
if (!isObject(obj)) {
throw new TypeError(obj + ' is not an object')
if (!(obj instanceof Object)) {
throw new TypeError(obj + ' must be an object')
}
if (typeof callback !== 'function') {
throw new TypeError(callback + ' is not a function')
throw new TypeError(callback + ' must be a function')
}

@@ -27,0 +26,0 @@ var ret = false

@@ -125,3 +125,3 @@ var Code = require('code')

describe('errors', function () {
it('should throw an error if obj is not an object', function (done) {
it('should throw an error if obj must be an object', function (done) {
var obj = 'notObject'

@@ -131,6 +131,6 @@ var callback = noop

var fn = every.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not an object/)
expect(fn).to.throw(/must be an object/)
done()
})
it('should throw an error if callback is not a function', function (done) {
it('should throw an error if callback must be a function', function (done) {
var obj = {

@@ -144,3 +144,3 @@ foo: 1,

var fn = every.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not a function/)
expect(fn).to.throw(/must be a function/)
done()

@@ -147,0 +147,0 @@ })

@@ -110,3 +110,3 @@ var Code = require('code')

describe('errors', function () {
it('should throw an error if obj is not an object', function (done) {
it('should throw an error if obj must be an object', function (done) {
var obj = 'notObject'

@@ -116,6 +116,6 @@ var callback = noop

var fn = filter.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not an object/)
expect(fn).to.throw(/must be an object/)
done()
})
it('should throw an error if callback is not a function', function (done) {
it('should throw an error if callback must be a function', function (done) {
var obj = {

@@ -129,3 +129,3 @@ foo: 1,

var fn = filter.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not a function/)
expect(fn).to.throw(/must be a function/)
done()

@@ -132,0 +132,0 @@ })

@@ -73,3 +73,3 @@ var Code = require('code')

describe('errors', function () {
it('should throw an error if obj is not an object', function (done) {
it('should throw an error if obj must be an object', function (done) {
var obj = 'notObject'

@@ -79,6 +79,6 @@ var callback = noop

var fn = forEach.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not an object/)
expect(fn).to.throw(/must be an object/)
done()
})
it('should throw an error if callback is not a function', function (done) {
it('should throw an error if callback must be a function', function (done) {
var obj = {

@@ -92,3 +92,3 @@ foo: 1,

var fn = forEach.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not a function/)
expect(fn).to.throw(/must be a function/)
done()

@@ -95,0 +95,0 @@ })

@@ -96,3 +96,3 @@ var Code = require('code')

describe('errors', function () {
it('should throw an error if obj is not an object', function (done) {
it('should throw an error if obj must be an object', function (done) {
var obj = 'notObject'

@@ -102,6 +102,6 @@ var callback = noop

var fn = mapKeys.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not an object/)
expect(fn).to.throw(/must be an object/)
done()
})
it('should throw an error if callback is not a function', function (done) {
it('should throw an error if callback must be a function', function (done) {
var obj = {

@@ -115,3 +115,3 @@ foo: 1,

var fn = mapKeys.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not a function/)
expect(fn).to.throw(/must be a function/)
done()

@@ -118,0 +118,0 @@ })

@@ -97,3 +97,3 @@ var Code = require('code')

describe('errors', function () {
it('should throw an error if obj is not an object', function (done) {
it('should throw an error if obj must be an object', function (done) {
var obj = 'notObject'

@@ -103,6 +103,6 @@ var callback = noop

var fn = map.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not an object/)
expect(fn).to.throw(/must be an object/)
done()
})
it('should throw an error if callback is not a function', function (done) {
it('should throw an error if callback must be a function', function (done) {
var obj = {

@@ -116,3 +116,3 @@ foo: 1,

var fn = map.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not a function/)
expect(fn).to.throw(/must be a function/)
done()

@@ -119,0 +119,0 @@ })

@@ -109,10 +109,10 @@ var Code = require('code')

describe('errors', function () {
it('should throw an error if obj is not an object', function (done) {
it('should throw an error if obj must be an object', function (done) {
var obj = 'notObject'
var callback = noop
var fn = reduce.bind(null, obj, callback)
expect(fn).to.throw(/not an object/)
expect(fn).to.throw(/must be an object/)
done()
})
it('should throw an error if callback is not a function', function (done) {
it('should throw an error if callback must be a function', function (done) {
var obj = {

@@ -125,3 +125,3 @@ foo: 1,

var fn = reduce.bind(null, obj, callback)
expect(fn).to.throw(/not a function/)
expect(fn).to.throw(/must be a function/)
done()

@@ -128,0 +128,0 @@ })

@@ -124,3 +124,3 @@ var Code = require('code')

describe('errors', function () {
it('should throw an error if obj is not an object', function (done) {
it('should throw an error if obj must be an object', function (done) {
var obj = 'notObject'

@@ -130,6 +130,6 @@ var callback = noop

var fn = some.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not an object/)
expect(fn).to.throw(/must be an object/)
done()
})
it('should throw an error if callback is not a function', function (done) {
it('should throw an error if callback must be a function', function (done) {
var obj = {

@@ -143,3 +143,3 @@ foo: 1,

var fn = some.bind(null, obj, callback, thisArg)
expect(fn).to.throw(/not a function/)
expect(fn).to.throw(/must be a function/)
done()

@@ -146,0 +146,0 @@ })

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