immutable-object-methods
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -18,3 +18,3 @@ 'use strict'; | ||
var isObject = function isObject(obj) { | ||
return (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null; | ||
return (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null && !Array.isArray(obj); | ||
}; | ||
@@ -21,0 +21,0 @@ |
import assign from './assign'; | ||
const isObject = obj => typeof obj === 'object' && obj !== null; | ||
const isObject = obj => typeof obj === 'object' && obj !== null && !Array.isArray(obj); | ||
@@ -5,0 +5,0 @@ const mergeDeep = (input = {}, changes) => { |
{ | ||
"name": "immutable-object-methods", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Update normal plain javascript object, immutable style. Simlar to how immutable.js, seamless-immutable etc does it but a lot smaller and simpler.", | ||
@@ -24,3 +24,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"ava": "^0.15.1", | ||
"ava": "^0.16.0", | ||
"babel-cli": "^6.8.0", | ||
@@ -30,4 +30,4 @@ "babel-core": "^6.8.0", | ||
"package-json-to-readme": "^1.5.1", | ||
"semistandard": "^8.0.0", | ||
"snazzy": "^4.0.0" | ||
"semistandard": "^9.0.0", | ||
"snazzy": "^5.0.0" | ||
}, | ||
@@ -34,0 +34,0 @@ "dependencies": { |
35
test.js
@@ -158,2 +158,37 @@ import test from 'ava'; | ||
test('mergeDeep with new unchanged array', t => { | ||
const input = Object.freeze({ | ||
a: 'b' | ||
}); | ||
const changes = Object.freeze({ | ||
a: 'yo', | ||
c: [1, 2, 3] | ||
}); | ||
const actual = mergeDeep(input, changes); | ||
const expected = { | ||
a: 'yo', | ||
c: [1, 2, 3] | ||
}; | ||
t.deepEqual(actual, expected); | ||
t.is(actual.c, changes.c); | ||
}); | ||
test('mergeDeep two arrays, new array should replace the old one', t => { | ||
const input = Object.freeze({ | ||
a: 'b', | ||
c: [1, 2, 3] | ||
}); | ||
const changes = Object.freeze({ | ||
a: 'yo', | ||
c: [1, 2, 3] | ||
}); | ||
const actual = mergeDeep(input, changes); | ||
const expected = { | ||
a: 'yo', | ||
c: [1, 2, 3] | ||
}; | ||
t.deepEqual(actual, expected); | ||
t.is(actual.c, changes.c); | ||
}); | ||
test('mergeDeep with unchanged value', t => { | ||
@@ -160,0 +195,0 @@ const input = Object.freeze({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24698
715
1