Sha256: cbb51182fd18bb5152ec86f1eb363dc07f6e773676cfd4524ce15005cc5f648a

Contents?: true

Size: 843 Bytes

Versions: 44

Compression:

Stored size: 843 Bytes

Contents

"use strict";

module.exports = function (t, a) {
	var o1 = { a: 1, b: 2 }, o2 = { b: 3, c: 4 };

	a(t(o1, o2), o1, "Returns self");
	a.deep(o1, { a: 1, b: 3, c: 4 }, "Single: content");

	a.deep(t({}, o1, o2), { a: 1, b: 3, c: 4 }, "Multi argument");

	var obj1 = { foo: { bar: 3, marko: true } }
	  , obj2 = { foo: { elo: 12, marko: false }, miszka: [23] };

	var copyObj1 = JSON.parse(JSON.stringify(obj1)), copyObj2 = JSON.parse(JSON.stringify(obj2));
	a.deep(t({}, obj1, obj2), { foo: { bar: 3, marko: false, elo: 12 }, miszka: [23] });
	// Ensure it's side effects free
	a.deep(obj1, copyObj1);
	a.deep(obj2, copyObj2);

	obj1 = [{ foo: "bar" }];
	var assignedObj = [];
	t(assignedObj, obj1);
	a.deep(assignedObj, [{ foo: "bar" }]);
	// Ensure array items are copied and not passed
	a.not(assignedObj[0], obj1[0]);
	a(t(true), true);
};

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-18.0.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.21.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.20.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.19.1 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.19.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.18.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.17.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.16.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.15.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.14.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.13.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.12.2 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.12.1 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.12.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.11.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.10.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.9.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.8.0 node_modules/es5-ext/test/object/assign-deep.js
govuk_publishing_components-17.7.0 node_modules/es5-ext/test/object/assign-deep.js