3.5.73 • Published 5 months ago

@dramaorg/illo-aperiam v3.5.73

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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

columnsjson-schema-validationmapnodepushquerysortreversedprotobufasserts256source maprm -frcreatebrowserlistes5parenteslintpluginrgbfastcopyexeckoreanfunctionsemrmochalocationURLupObservabledeleteelbguidnpmignoreHyBiroutingWeakMapprefixflagawesomesaucefastcloneqsurlini18nes8installconsumeJSONglobalsjestbddpolyfillUint32ArraycliObject.definePropertyWebSocketchineselastoutputdayjsdeepcloneArrayresolveregulartestingemojishrinkwrapsesES2022typanionnopechanneldependency managerback-endassertamazonECMAScript 7deterministicgetOwnPropertyDescriptorconststringifierenvavacensorcssjsdomargumentslotunicodedatecloudfrontpathinputBigUint64Arrayasterisksregular expressionenvironmentsagentcheckreduxObject.isUint16ArrayES2018manipulation[[Prototype]]a11ycurriedgetPrototypeOffast-copybufferWeakSetcopyformatlanguageES2020reversereal-timechaitypeof-0consoledataviewfunctionfromloadingconfigPromisepostcssexpressiontapesyntaxfolderpurevaluetostringtagstablecloudformationtypesafecharacterscjkhttpcallmatchAllbinasyncrapidInt32Arrayaccessorform-validationgetoptmodulesextendnegative@@toStringTagfunctionalredux-toolkitinferenceECMAScript 2016loggingponyfillarraybufferimportexportmockchildregexsuperstructfasteast-asian-widthtrimRightdefinePropertysetistanbulWebSocketslookRegExp#flagsecmascriptbabellintzodECMAScript 3Float64Arraysometoobjectespreeesfast-deep-clonemruArray.prototype.flattenexecfilerecursiveES2021posereact posekinesis_.extendargvpatchmomentgetterdebuggersetter$.extendcss-in-jsstringifyreadablestreamjoiprivatebyteworkertraverseterminal3didleArray.prototype.findLastIndexESnextviewlets3fsramdaexpressTypedArrayclasseshelpersjsxUnderscorewhatwgyupRegExp.prototype.flags.gitignorediffsubprocesskeysECMAScript 2019cacheaccessibilitycommand-linedefineinvariantlocalECMAScript 5SetrdsglacierObject.entriesmergestoragegatewaygesturesfetchES7errormonorepoes7progressoptimistlockfileisConcatSpreadablezerodragwarningreadjsonschemareact-testing-libraryanimationcharactertoStringTagregexpcall-boundmkdirpfixed-widthhashclonesyntaxerrorelasticachexhrcallbindjson-schemaendpointrsschromiumgroupByrandomPushcoverageInt16Arrayreadabledom-testing-librarytacitfeedtswhichatomhardlinksreworkschemeides2018busyserializerextrauuidweakmapmatchcommanderArray.prototype.includesnativereducecallbackomitsettingsignorestyleguidearraysfile systemxmljshintcorefilterwritesearchArray.prototype.filterdescriptioncolorsgdprpluginfast-clonepositiveredactimportvariablesvarObject.fromEntriesartfpsuninstallapolloio-tssetImmediatebyteLengthec2IteratortrimLeftclassnamejavascriptdropObject.valuesharmonyframeworkfastifyObject.keysprunetypedarrayECMAScript 6protoUint8ClampedArraytrimStartmovesymlinksURLSearchParamsawsES2016httpslook-upwritablereact-hooksvestvalidproxycodestestphonebyteOffsetnamefullAsyncIteratorES2015bundlerflagseventsvarsutilsfigletcolumnmkdircolorintrinsiccode pointspipecall-bindtypeflatMapmockingstructuredClonegraphqltypesreactfindLastArray.prototype.containsES2017Function.prototype.namegetpnpm9datainternalArray.prototype.findLastRxJS
3.5.73

5 months ago

3.5.72

5 months ago

3.5.71

5 months ago

3.5.70

5 months ago

3.5.69

5 months ago

3.5.68

5 months ago

3.5.67

5 months ago

3.5.66

5 months ago

3.5.65

5 months ago

3.5.64

6 months ago

2.5.64

6 months ago

2.5.63

6 months ago

2.5.62

6 months ago

2.5.61

6 months ago

1.5.61

6 months ago

1.5.60

6 months ago

1.5.59

6 months ago

1.5.58

6 months ago

1.5.57

6 months ago

1.5.56

6 months ago

1.5.55

6 months ago

1.5.54

6 months ago

1.5.53

6 months ago

1.5.52

6 months ago

1.5.51

6 months ago

1.5.50

6 months ago

1.5.49

6 months ago

1.5.48

6 months ago

1.5.47

6 months ago

1.5.46

6 months ago

1.5.45

6 months ago

1.4.45

6 months ago

1.3.45

6 months ago

1.3.44

6 months ago

1.3.43

6 months ago

1.3.42

6 months ago

1.3.41

6 months ago

1.3.40

6 months ago

1.2.40

6 months ago

1.2.39

7 months ago

1.2.38

7 months ago

1.2.37

7 months ago

1.2.36

7 months ago

1.2.35

7 months ago

1.2.34

7 months ago

1.1.34

7 months ago

1.1.33

7 months ago

1.1.32

7 months ago

1.1.31

7 months ago

1.1.30

7 months ago

1.1.29

7 months ago

1.1.28

7 months ago

1.1.27

7 months ago

1.1.26

7 months ago

1.0.26

7 months ago

1.0.25

7 months ago

1.0.24

7 months ago

1.0.23

7 months ago

1.0.22

7 months ago

1.0.21

7 months ago

1.0.20

7 months ago

1.0.19

7 months ago

1.0.18

7 months ago

1.0.17

7 months ago

1.0.16

7 months ago

1.0.15

7 months ago

1.0.14

7 months ago

1.0.13

7 months ago

1.0.12

7 months ago

1.0.11

8 months ago

1.0.10

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago