1.1.1 • Published 12 days ago

@hutechorganization/bookish-octo-guide v1.1.1

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

@hutechorganization/bookish-octo-guide 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('@hutechorganization/bookish-octo-guide');
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('@hutechorganization/bookish-octo-guide');
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('@hutechorganization/bookish-octo-guide');
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

browserPushform-validationdotenvcoercibledeleteES2022queueMicrotaskautoscalingsymbolspiperedactECMAScript 2015ECMAScript 2018fastclone.envsuperagentcomparemoveresolvepromisesopenchaiinstallerArray.prototype.filterpolyfillwhatwgdeepkarmatouchregexpRegExp#flagsjasmineindicatordataviewJSON-Schemaloadbalancingloadingcss-in-jstoobjectes-shimstc39containsweaksetrgbparentssuperstructmulti-packagedataViewyamlsafecode pointses2016isConcatSpreadableperformantformcss nestingcallbackserializeString.prototype.matchAllbddformattingimportstringifierStyleSheetanimationreduxeventDispatcherpreprocessorratestablestringifyhardlinksReactiveExtensionsexit-codei18ndomtypeofauthdeepcopypyyamlwhichoptimistchrometrimEndArray.prototype.findLastIndexio-tskinesisES5look-up$.extendECMAScript 7ES2023bootstrap cssArray.prototype.includesFloat32ArraysanitizeutilestreefindLastIndexlogtoStringTagstreamtostringtagtoolkiteventEmitterES6Uint16ArraymatchesinferenceflattenassertionWeakMapnamesmakees5ESnextsignalskoreanURLroute53setPrototypeOftrimStartvalidationserialization__proto__letreducerstylesheetomittelephoneparsereslint-pluginfolderES7ES2019lessiamhaslibphonenumberpasswordthreeelectrongradients css3JSONreact-hooksES2015fpsString.prototype.trimloggerbalancedfullminimalcharactersschemestyleguideextensionES2017bundlingWeakSetArrayBuffer#sliceUnderscoreSetshimwarningcall-boundweakmapinl10najaxfsdeepclonefindupsymbolprivatecurriedsyntaxerrorECMAScript 3buffersjoizodquerystringpackage managereslintplugines-shim APIStreamtakemoduletypeerrorformatjsonpathsimpledbprototraversedatacolumnspostcssdatastructureconcurrencynodehigher-orderwatchInt32Arrayramdaprotocol-buffersfasttoArraycallarraybuffergroupratelimithttpbeanstalkpositivefindutilityrmdirUint32Arrayclass-validatortacitnegative zerofast-clonexssstarterlesscssbootstrap lesshookforminputObservablesdescriptorsargumentswfmatchinternalhttpstranspilerObject.getPrototypeOfconnectvpcMicrosoftmkdirpFunction.prototype.namebrowserslistgenericscloudfrontpicomatchasciiconsoleconstargparsereactTypeScriptnested cssrm -rfbcryptassignfetchreact-hook-formconfigurablesyntaxcollection.es6json-schema-validatorunicodesymlinkvariablescolumnpatchmomentponyfillcheckrdserrorargsuser-streamsefficienttestingECMAScript 6pnpm9nameES3postcss-plugininterruptsyupconcatMapenderwordwrapcligradients cssruntimewordbreakinternal slotdifffullwidthwafarktypecompile lesses-abstractpluginmime-dbpopmotionjson-schemalanguageencryptionCSStypanionequalitythrottleObject.valuesrandominspectsetteres7flagdeep-cloneintrinsicpromisedependency managercryptoupmacosmiddlewarecreateObject.fromEntriesecmascriptqsstreams2Int16Arrayscheme-validationcloudformationtapvestflatMapbrowserlistMapcolor0parentelasticachegetoptArrayBuffer.prototype.slicesnssettingsincludestranspilepathlistenerscss variabledescriptioninvariantviewconsumeposeownparsenodejsjsdiffconfigrequireurltimeieECMAScript 5execArray.prototype.flatdragcolourcurlavasymlinksclasseslimitedless.jsawesomesaucedeterministices2015glacierstreamsserializerprivate dataagent[[Prototype]]WebSocketsemrmkdirsvalidatoroptimizermochaphonegetOwnPropertyDescriptorreadablettythroatextendpackagesclassnameprunebufferformswgetgetassertsprotobufcoresharedarraybufferchineseReactiveXstringwalkingcommand-lineReflect.getPrototypeOfTypeBoxjQuerytesterIteratorrapidslicegdprmapreduceless cssdebuggerenvtrimLeftrecursive-0iterationairbnbawaitschemaboundiskeyswebObject.isa11yirqfind-upebsvalidatetslibeast-asian-widthbyteLengthregularxtermhasOwnPropertyUint8Arrayoffsets3dropbatchObject.assignendpointzerofastifyforEachvalidmimetypestrimRightframercallbindemitECMAScript 2020deep-copyrangeerrorwritebyteOffsetlimitrmmodulesslotfast-copyES2018linkFloat64ArraycodesexitauthenticationflagscollectionaccessibilityregexRxJSrm -frmixinsspecglobprettyuninstall
1.1.1

12 days ago

1.1.0

13 days ago