Socket
Socket
Sign inDemoInstall

immutable-object-methods

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immutable-object-methods - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

2

dist/merge-deep.js

@@ -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": {

@@ -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({

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