1.0.0 • Published 14 days ago

@ptkhanh94npm/quaerat-dolorem-quod v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

@ptkhanh94npm/quaerat-dolorem-quod 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('@ptkhanh94npm/quaerat-dolorem-quod').getPolyfill(); // returns native method if compliant
	/* or */
var assign = require('@ptkhanh94npm/quaerat-dolorem-quod/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('@ptkhanh94npm/quaerat-dolorem-quod').shim();
	/* or */
var shimmedAssign = require('@ptkhanh94npm/quaerat-dolorem-quod/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('@ptkhanh94npm/quaerat-dolorem-quod').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

real-timedefaultparserECMAScript 2017constrequirecharactermixinsmakecssdiffjson-schema-validatoresmake direventDispatcherfolderdataViewfilterlimitedconcatincludesinspecttakevalidatornameautoprefixerconcurrencytouchfpchromedeep-copywalkingdomlogjavascriptcommand-lineaccessorcorehandlersdescriptioncolourTypeBoxinstallgraphqlfast-deep-clonelazySymbol.toStringTagRxJSchannelassertnativeclass-validatoranimationminimall10nauthTypedArraypackage.jsonstylestylesjson-schemasignalbrowserlistreact-testing-libraryprototypeECMAScript 2022envbusypruneargumentstypedarraysutilityawesomesaucecircularlintES7limitpuretermdirtoobjectregexpwgetregular expressionsortedrm -frlengthcensorcharactersObject.isspringequalityjsdomObjecteslintpluginparentstarterprotocol-buffersdataviewfindLastIndexfast-deep-copyES2021valueprotojsdiffredactdeletetrimStartgetPrototypeOfes2016connectbreaktyped arrayhasOwnvalidateawaitpropertyECMAScript 2021filegradients cssstreams2inputtslibextendbootstrap lessjsoncees6ArrayBuffer#sliceutil.inspectassertionecmascriptfetchconcatMapStyleSheetcryptoargparsedatexdgdependency managerimportavaiscorsbddjsxinstallerpropertiesstylesheetsideArray.prototype.flatMapeslint-pluginstringifyhardlinksflattenHyBiefficientbabel-coretoStringTagcliwhichreact posethrottlees-shim APIFunction.prototype.nameviewUint16ArraysameValueZeropathquotecode pointsansilinewraphelpersArray.prototype.containsframerReactiveXmkdirtrimRightES8commandtoolkittsdeep-clonetypanioneslintconfighasexpressionpositiveoutputbyteOffsetprivaterequestmrutoArrayfindLastJSONES2019-0createurltestingapolloObservablespeedpreserve-symlinksbindrmdiryamlObject.defineProperty$.extendnested csstddjson-schema-validationgradients css3directoryregular expressionsdescriptorform-validationString.prototype.matchAlltypesafereact animationperformantwatchingSymbolpackage managercolorfullwidthPushsomecopyprotobufcodesmatchcore-jsserializationajaxless compilerzerostringtypeloadinges2018moveECMAScript 6figletposefullsyntaxerrorWebSocketsRFC-6455io-tsobjectwatchrateArray.prototype.filter0structuredClonemimetypesauthenticationinternalcollection.es6workspace:*popmotiones8definewebreduxphonelooknamesURLrmformattinginferenceinterruptsmkdirsjsontrimEndcall-bindtypedobjdayjsstartES2018Object.fromEntriesArray.prototype.findLastoptimistexpresssignalsstatusopenermacossafestylingkarmaextensionsharedlruwhatwggenericsarrayeditorlanguagepackagechromiumsettingsutilsFloat64ArrayMapiteratorfsschemeerror-handlinggetcolorsstatelessparsepersistentescapeuser-streamsObject.keysjQueryfull-widthcachePromisemkdirpBigInt64ArrayhooksbyteLengthrapidreact-hookses-abstractregularpromiseshrinkwrapclonetypedarrayremoveschemauuidsearchopencompile lesshashspinnerschaichildflagencryptionindicatorirqrfc4122linkgettervariablesmimegdprpluginiees2015utiliterationreadvariables in csslockfilecall-boundcmdvalidationUint8ArrayECMAScript 2018symlinkimmerslotpoint-freecjkforEachisConcatSpreadabledeepcopyexecutablettyes5unicodewatchFilechineseJSON-SchemaglobreusezoddescriptorseveryWeakSetstdlibassignwebsitelesscssclassnamesInt8Arrayreduceshebangcss lessclassnameECMAScript 3bootstrap cssflagspreprocessormapentries[[Prototype]]valuessuperstructsymbolparentsIteratorstabledragtranspileaccessibilityeslintxdg-openvarargumentemojiES3wordbreakprefixESbluebirdbabelsymlinksrecursivedeeplibphonenumberoperating-systemvestjwtmime-dbexecolumnsassertsairbnbruntimeregexconfigurablemomentfunctionAsyncIteratorfindasttypescriptrangeerrorshimpipeStreamReflect.getPrototypeOfdefinePropertyrandombrowserSetURLSearchParamsprivate dataconsumesyntaxES5slicecallbounddotenvpicomatchstyleguidecheckxhrsigintflatES2022walkwordwrapmodulesfunctionspostcssless csssetcss nestingshellarraybufferfseventsoptimizerreadablenegative zero6to5ES2016offsetECMAScript 2015typeofBigUint64ArrayUint32ArrayArrayBufferECMAScript 5httpsRxflatMapdeterministicspinnerserializetranspilerterminalmatchAllmergepromisesRegExp#flagsmiddlewareString.prototype.trimspawnfast-clonestreamsfastUnderscoresortserializeridletraversecallbackfile systemtypespostcss-plugineventEmitterponyfillequalArray.prototype.findLastIndexformatextraratelimit256batchtapematchesqslastES2023mobileESnextfinduptaskES6waapiECMAScript 2019collectionECMAScript 2023jsonschemaArray.prototype.includesprettyless.jsargvconsolees7errorasynctostringtagUint8ClampedArraytrimLeftdeepcloneasciidebuggerbundlerimmutableconfigguidcss variabledataboundsetPrototypeOfdatastructurei18npnpm9nope@@toStringTagintrinsictacitECMAScript 7streamgesturestest__proto__ECMAScript 2020nodecolumnlinuxfastcopyloggingurlsmulti-packagebannersanitize3dfastcloneReactiveExtensionsnodejseast-asian-widthfastifycompilerObject.valueslessrgbjestartcss-in-jsarraysbytetrimrobustendersharedarraybufferfunctionalWeakMapargssetterformssuperagentvisualweakmapES2020groupBycomputed-typeswidthcurriedhigher-orderWebSockettelephonetc39toolsInt16ArrayutilitiesYAMLarktypejoiestreeomitemitexitramdaMicrosoftwritetimedom-testing-librarytextqueueMicrotaskjasmineTypeScriptredux-toolkita11ywaitwindowskeybufferapisetImmediateStreamsmoduleObject.getPrototypeOfpackagesinternal slotletArray.prototype.flatkoreancallbindenvironmentpushclientdebugpasswordObject.assignhookformxssformFloat32Arraylook-upfind-upwrapbrowserslistmochaES2017loggershamiteratereadablestreamdropes-shimsspecgetopttoSortedpatchthreescheme-validationfixed-widthnpmwarningtesterreducerxtermenumerableexecqueryprocesscryptweaksetdependenciesgroupframeworkwatcherfromObject.entriesfast-copycurlajv
1.0.0

14 days ago