Socket
Socket
Sign inDemoInstall

immutable-object-methods

Package Overview
Dependencies
Maintainers
1
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.1.1 to 1.1.2

8

dist/assign.js

@@ -13,8 +13,8 @@ 'use strict';

exports.default = function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
exports.default = function (first) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return _objectAssign2.default.apply(undefined, [{}].concat(args));
return Array.isArray(first) ? _objectAssign2.default.apply(undefined, [[], first].concat(args)) : _objectAssign2.default.apply(undefined, [{}, first].concat(args));
};
import assign from 'object-assign';
export default (...args) => assign({}, ...args);
export default (first, ...args) =>
Array.isArray(first)
? assign([], first, ...args)
: assign({}, first, ...args);
{
"name": "immutable-object-methods",
"version": "1.1.1",
"version": "1.1.2",
"description": "Update normal plain javascript object, immutable style. Simlar to how immutable.js, seamless-immutable etc does it but a lot smaller and simpler.",

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

@@ -31,2 +31,11 @@ import test from 'ava';

test('set with array', t => {
const input = Object.freeze([0, 1]);
const actual = set(input, 0, -1);
const expected = [-1, 1];
t.deepEqual(actual, expected);
t.true(Array.isArray(actual));
});
test('setIn', t => {

@@ -109,2 +118,10 @@ const input = Object.freeze({});

test('assign w array', t => {
const input = [0];
const actual = assign(input, [1, 2, 3]);
const expected = [1, 2, 3];
t.deepEqual(actual, expected);
t.true(Array.isArray(actual));
});
test('mergeDeep', t => {

@@ -111,0 +128,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