1.0.0 • Published 1 year ago

@bobyzgirlllnpm/sint-quam-accusantium v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@bobyzgirlllnpm/sint-quam-accusantium Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An Object.assign shim. Invoke its "shim" method to shim Object.assign if it is unavailable.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec. In an ES6 environment, it will also work properly with Symbols.

Takes a minimum of 2 arguments: target and source. Takes a variable sized list of source arguments - at least 1, as many as you want. Throws a TypeError if the target argument is null or undefined.

Most common usage:

var assign = require('@bobyzgirlllnpm/sint-quam-accusantium').getPolyfill(); // returns native method if compliant
	/* or */
var assign = require('@bobyzgirlllnpm/sint-quam-accusantium/polyfill')(); // returns native method if compliant

Example

var assert = require('assert');

// Multiple sources!
var target = { a: true };
var source1 = { b: true };
var source2 = { c: true };
var sourceN = { n: true };

var expected = {
	a: true,
	b: true,
	c: true,
	n: true
};

assign(target, source1, source2, sourceN);
assert.deepEqual(target, expected); // AWESOME!
var target = {
	a: true,
	b: true,
	c: true
};
var source1 = {
	c: false,
	d: false
};
var sourceN = {
	e: false
};

var assigned = assign(target, source1, sourceN);
assert.equal(target, assigned); // returns the target object
assert.deepEqual(assigned, {
	a: true,
	b: true,
	c: false,
	d: false,
	e: false
});
/* when Object.assign is not present */
delete Object.assign;
var shimmedAssign = require('@bobyzgirlllnpm/sint-quam-accusantium').shim();
	/* or */
var shimmedAssign = require('@bobyzgirlllnpm/sint-quam-accusantium/shim')();

assert.equal(shimmedAssign, assign);

var target = {
	a: true,
	b: true,
	c: true
};
var source = {
	c: false,
	d: false,
	e: false
};

var assigned = assign(target, source);
assert.deepEqual(Object.assign(target, source), assign(target, source));
/* when Object.assign is present */
var shimmedAssign = require('@bobyzgirlllnpm/sint-quam-accusantium').shim();
assert.equal(shimmedAssign, Object.assign);

var target = {
	a: true,
	b: true,
	c: true
};
var source = {
	c: false,
	d: false,
	e: false
};

assert.deepEqual(Object.assign(target, source), assign(target, source));

Tests

Simply clone the repo, npm install, and run npm test

positiveregular expressiontoolsmodulestaskpruneInt8ArrayrapidbuffersTypedArraylook-upprotocol-buffersfindLastcjkenvargparsestreamsless.jsurlkoreanfigletnativesequenceobjfunctionalECMAScript 2019reducevestfastdateelbECMAScript 2016nopeES2016toStringTagomiteslintplugincreateutilitiesiterationmixinsInt32ArrayECMAScript 3jsdiffagentforEachyupwebtypesafetrimEndhotES2015functionprotobufqssetoncedomformattingtddaccessordynamodbES2021airbnbiteratornegativeIteratormimetypesconsoleUint32Arrayescapemonorepoestreecompile lessrangeerrornamebcryptbreakwritexhrES2019deleteWebSocketsgraphqlcss-in-jsweakmapsharedpicomatchstatelessstyled-componentstoobjecttapasciiisConcatSpreadablecallbounddatastructurefiletrimLeftSet256fullwidthqueueexpressionlinkfast-deep-copyrmschemehttpspreprocessorECMAScript 5npmrecursivepyyamlsuperagentawaitStreamsassertreadablees6moveECMAScript 6Float64ArraywafwritablegdprArrayBuffer#slicetouchshellendpointfolderschemaefficientrandomgroupByeventsless cssbound0openlibphonenumbers3bannerstringifytypeerrornamesmkdirpbundlingassignArray.prototype.includesfastcloneInt16Arrayspinnersloadingincludessuperstructio-tsjsdomArray.prototype.findLastIndextsoptionbindArray.prototype.flattenclieventEmitterObject.assignpassworddeep-clonewatchpromisecss lessdeepcopyregexpES7diffless compilerencryptionmatchsymbolless mixinstoArraybrowserslistformattimeaccessibilityajvawesomesaucehashvaluecollectionpreserve-symlinksWeakSetfastifyUint8ArrayamazonrdscolorprogresstrimdeepinECMAScript 2018resolveinternalenderpropimportexportautherrorreact-hook-formArray.prototype.filterwalkreact-hookschaiES8kinesisUint16ArrayswfpackageseslintES2018autoscaling__proto__typescriptsameValueZerosesqueueMicrotaskjwtcloudtrailstylingObject.definePropertycloudformationdeterministicdataviewpushfetchtypejasminecore-jscoredeepcloneiteratepropertiesmochadataViewwgetlazydirectoryeventDispatcherStreamfunctionsform-validationlengthHyBistoragegatewaycallpluginperformancecolumnjsstructuredClonenodestarterdescriptorkarmabootstrap cssthroatRegExp.prototype.flagsthrottleES6typeofpromisesinputzerobusyes2018arraybuffermakeinferencegroupArrayBuffer.prototype.slicereact-testing-libraryframeworkObject.getPrototypeOfES5higher-orderdom-testing-libraryRegExp#flagsremovebrowserlistutilES2020configurableec2finduppropertysortstateObservableexeccolour@@toStringTagentriesPromiseemojiextrapathtestingtelephoneroute53command-lineassertionmake dirchromees7chromiumfast-copyl10ndirflagnegative zeromulti-packagefseventscolorsObject.valuescensortoolkitsyntaxerrorcharactershrinkwraptypedarrayRxJS
1.0.0

1 year ago