3.0.12 • Published 18 days ago

@diotoborg/culpa-at-cumque v3.0.12

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

@diotoborg/culpa-at-cumque Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES5 spec-compliant Array.prototype.map shim/polyfill/replacement that works as far down as ES3.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.

Because Array.prototype.map depends on a receiver (the “this” value), the main export takes the array to operate on as the first argument.

Example

var map = require('@diotoborg/culpa-at-cumque');
var assert = require('assert');

assert.deepEqual(map([1, 1, 1], function (x) { return x + 1; }), [2, 2, 2]);
assert.deepEqual(map([1, 0, 1], function (x) { return x + 1; }), [2, 1, 2]);
var map = require('@diotoborg/culpa-at-cumque');
var assert = require('assert');
/* when Array#map is not present */
delete Array.prototype.map;
var shimmedMap = map.shim();
assert.equal(shimmedMap, map.getPolyfill());
var arr = [1, 2, 3];
var add4 = function (x) { return x + 4; };
assert.deepEqual(arr.map(add4), map(arr, add4));
var map = require('@diotoborg/culpa-at-cumque');
var assert = require('assert');
/* when Array#map is present */
var shimmedMap = map.shim();
assert.equal(shimmedMap, Array.prototype.map);
assert.deepEqual(arr.map(add4), map(arr, add4));

Tests

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

full-widthES2021Uint16Arraydirectorynegative zero__proto__key valuequerystringhasOwnPropertyloadingflagECMAScript 2016inputdomrobustreact-testing-librarya11ydataviewwritablesesimmutableStreamiefoldersettingsES2018redux-toolkitES2022spinnerCSSairbnbflatMapoptimistmatchregular expressionsthreebluebirdidle$.extendparentcopyeveryes-abstractexecroute53xtermmappackageseast-asian-widthpicomatchcharacterObservableses8viewpropertywgetlintamazonwalkweakmapaccessorRxString.prototype.trimtddfast-deep-copyES2019mkdirpelasticachesyntaxerrorTypeScriptsafeArray.prototype.flattenURLthrottletypescriptcmdflattenshebangbundlerReflect.getPrototypeOfjQuerywordwrapcallbindstringifierglacierjoi3dcoreslicechannelterminalidfast-deep-clonewebsitestylesfetchminimalprogressStreamsexpressiterationeventEmittercalldragenumerablefunction.lengthbindbyteprotocol-buffersUint8ClampedArrayjsxCSSStyleDeclarationECMAScript 2020Array.prototype.filteravaInt32Arrayttyfile cachemimetypesargscode pointslazyes5getPrototypeOfbusyarraysconcattypanionasciiPushECMAScript 2018parsingurlassertiontesteridentifiersloggingwaapidatastructuredynamodbstyled-componentstraverseES2016es2015argveslint-pluginphoneworkflowReactiveExtensionsswfelbreduxsetPrototypeOfrandomObject.keysfast-clonechromiumflatbeanstalkes2016pathregexrequireregularhelperfindupfile systemcore-jsvarsIteratornumberfunctionaltaskeslintjavascriptenvironmentssymbolwordbreakrouteFloat64Arrayfilemergejsmulti-packagemonorepowarningvalueserializeArray.prototype.flatboundpluginstreams2ponyfillTypedArrayresolveconvertawaitopenarktypechaicachetestingconcatMapUnderscoremochaeventDispatcherfind-upownRFC-6455groupByurlsrgbreuse-0redirectfilterimportexportsetterObservablesymlinktrimLeftlistenersfast-copybyteLengthoptimizerutil.inspectwaitajaxruntimebufferslimitedeslintpluginespreemkdirsSymbol.toStringTagoutputinstallersearchtrimStartargumentflagsemojiprocessregexpoptionfindLastIndexdatareadistanbulclientmapreduceuninstallkeyUint8ArrayastprotobuftelephonecontainsrdschinesecolourhelperscurldefinePropertyexpressionconsoleECMAScript 6debugWebSocketsguidasyncAsyncIteratornpmreact posereadablestreamECMAScript 5look-uplengthforEachautoscalingsameValueZerointernal slotisConcatSpreadablermglobtypedarrayobjiconvtextformattingefficientparentsgroupdeepcloneUint32Arraydeep-clonepromisesindicatorECMAScript 2021yupObject.getPrototypeOfstylingECMAScript 2015Set@@toStringTagequalYAMLframerwhichwhatwgtapeopenssharedglobales2017speedclass-validatorsuperagentbreakimmerES3linkbrowserES2015shimcodesquoteutilities0emitcompileres7ratelimitformESnextdiffvisualchildnodeObject.entriesglobalsspecdatechromepostcss-pluginsnsaccessibilitytrimRightkoreanwriteObjectkey parES5extensionArray.prototype.findLastSymbolkarmasymlinksescapeeditorschemagetoptapies2018rmdircolormime-dbvalueslogwidthreadabletypesaferatecolumnslocationperformanceimportsetvalidateeventscolumndataViewpropertieselectronECMAScript 2022typepackagezerotaplookhaslruagentbrowserlistlaunchconfigjsonreal-timesyntaxWeakMapcommanderpackage managertoStringTagArray.prototype.includesstringifyshrinkwrapformshookformserializationdeepcopybannerloadbalancingicuposetermcjki18njshintextraprefixstyleguidestructuredCloneebsiteratorhigher-orderawsthroatjsonpathassertobjectenderdircloudformationawesomesaucecligdprMap
3.0.12

18 days ago

3.0.10

20 days ago

3.0.11

19 days ago

3.0.8

22 days ago

3.0.9

21 days ago

3.0.7

23 days ago

3.0.6

24 days ago

3.0.5

25 days ago

3.0.4

26 days ago

3.0.3

27 days ago

3.0.2

28 days ago

3.0.1

29 days ago

3.0.0

30 days ago

2.0.0

1 month ago