1.0.0 • Published 11 days ago

@wemnyelezxnpm/porro-odit-eaque v1.0.0

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

@wemnyelezxnpm/porro-odit-eaque Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES2019 spec-compliant Array.prototype.flatMap 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.flatMap depends on a receiver (the this value), the main export takes the array to operate on as the first argument.

Getting started

npm install --save @wemnyelezxnpm/porro-odit-eaque

Usage/Examples

var flatMap = require('@wemnyelezxnpm/porro-odit-eaque');
var assert = require('assert');

var arr = [1, [2], [], 3];

var results = flatMap(arr, function (x, i) {
	assert.equal(x, arr[i]);
	return x;
});

assert.deepEqual(results, [1, 2, 3]);
var flatMap = require('@wemnyelezxnpm/porro-odit-eaque');
var assert = require('assert');
/* when Array#flatMap is not present */
delete Array.prototype.flatMap;
var shimmedFlatMap = flatMap.shim();

var mapper = function (x) { return [x, 1]; };

assert.equal(shimmedFlatMap, flatMap.getPolyfill());
assert.deepEqual(arr.flatMap(mapper), flatMap(arr, mapper));
var flatMap = require('@wemnyelezxnpm/porro-odit-eaque');
var assert = require('assert');
/* when Array#flatMap is present */
var shimmedIncludes = flatMap.shim();

var mapper = function (x) { return [x, 1]; };

assert.equal(shimmedIncludes, Array.prototype.flatMap);
assert.deepEqual(arr.flatMap(mapper), flatMap(arr, mapper));

Tests

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

gradients css3ArrayBuffertc39getsanitizeguidpluginurlstypeofRegExp#flagsl10ncorsa11yshebangsameValueZerothreespecdataviewgroupecmascriptdateresolveconfigurablenopewarningflagsgetoptmkdirtostringtagRFC-6455jsRegExp.prototype.flagsequalityfindsharedarraybufferpackage manageromittypemacosSetkeysintrinsicworkspace:*asynctypesMicrosoftexecutablelinewrapappbluebirdfunctionalinputauthenticationpopmotionterminalredactrmless cssESmixinszeroCSSfpdom-testing-librarystylingArray.prototype.flatcompile lesserrorvarES7isConcatSpreadablevalid_.extendES2020extendArray.prototype.findLastIndexECMAScript 2016writecoercibleObject.assignObject.entriespackageRxboundhelperspicomatchreadweaksetobjwritableunicodedeep-copymkdirpschemejsdomtrimStartfast-copycomputed-typesstylesheetbabel-corelogless.jsutilsjson-schema-validatorFloat64Arrayspinnersdefine.envreadableenvironmentES2018xdgcopyxdg-openexpressbootstrap lessreadablestreamminimalpathdescriptionkeyObservablesargumentInt32Arrayrangeerrorpatchtypeerrorflatparentsequencefseventstyped arrayfast-cloneJSONbufferlibphonenumberArray.prototype.flatMapconcatES3toStringTagbatchwordbreakpurestringifierdeep-cloneYAMLObject.fromEntriesbusymimecss lessvestauthwidthcallbackconcurrencytslibieesiterateirqreduxnamesansiserializercmdIteratorcallartstructuredClonewatcherpropObject.getPrototypeOfrobustmonorepomulti-packagedefaultconstES2023es2018listenersArray.prototype.flattenutilitieslengthbundlingwebHyBiuser-streamsStreamsTypeBoxRxJScompilerTypeScriptcall-bindmaprequirehardlinksfsglobarraysdescriptorECMAScript 5formsmimetypestelephoneopenprefixoptimisteast-asian-widthfilterObservableassertionBigInt64Arrayrfc4122termjsdiffcheckkarmaastyamlsuperagentStreamclientSymbolCSSStyleDeclarationairbnbperformantttyWebSocketsES6watchFilevalueschemaqueueMicrotaskInt8ArrayparseregexnamefullwidthgesturesdeepclonejoibrowserlistUint8ClampedArrayMaplastuninstallObject.keysform-validationbootstrap csschromees2017configinternal[[Prototype]]traversebuffersArrayfunctionstaptestingES2022typedarraysajvcurlaccessibilityencryptionprototacitReactiveXmiddlewarecallboundAsyncIteratorzodfindLastIndexhascryptobyteOffsetchildsettingsreal-timeredux-toolkitECMAScript 2022dayjseslint-pluginArray.prototype.containstspropertytestercachesigtermWeakSetoptimizerextensioncollectionstylesortedbyteLengthcss nestinggraphqlserializeES5whichsharedponyfillESnexteslintconfigprunecolor0exitspringcorequotemkdirsjasminespawnletcomparehasOwnprocessframerpostcsscommand-linesettervalidatefetcheverytddlaunchcommandersymlinkswalkfileoperating-systemarraycss-in-jstestdefinePropertyPushrm -rfsiginttranspilershamURLcodesconsumelook-upajaxerror-handlingfulles-abstractexecformatgradients cssfastcopyopenerjsonschemaaccessordeepcopydeterministicUint32Arrayreact animationPromiseprotocol-buffersregular expressionsrm -frbcryptfantasy-landmime-dbxssfindLastescapemake dirreusematchAlljsonnumbercreatestylesviewchromiumSymbol.toStringTaghttpsasciijwtECMAScript 2020assignrecursiveTypedArrayreducemetadataECMAScript 6Array.prototype.includesisposestringmoveECMAScript 7fastifyargumentssanitizationpreprocessornested cssvariablespositiveserializationcolumnstablesearchchaiefficientimmerqssortchinesesymbolswebsitecss variableregularArray.prototype.filteroptionoffsetratetypescriptReflect.getPrototypeOfenvinvarianteslintthrottleflagcolorsspinnerkoreantoSortedpushmodulesdotenvwhatwgquerystringArrayBuffer#slicestyled-componentsinternal slotutiles-shimslanguageStyleSheetstatusvisualECMAScript 2021stringifyshimurlclass-validatorinferenceshelltoArrayprotobuf3dformattinges-shim APIbabelInt16ArraytrimRightloggerdragfast-deep-cloneiddebugstreamscore-jstext$.extendmobilewordwrapsymlinkhookformstreams2diffreact-testing-librarymomentexeECMAScript 3argvsignalspasswordjson-schema-validationfastcloneeditordependenciesforEachdrop6to5callbindcharacterrapidES2017argsinstallmodulebindpostcss-pluginfastArray.prototype.findLastemojimocharatelimitpipees2015figlet256private__proto__toolkitES2021indicatores5jQueryinspectWebSocketES2016curriedstarterparserFunction.prototype.namecensorqueryvalidationeventEmitterrequestyupexpressionuuidlinuxconcatMapWeakMapcjkfull-widthObject.valuesdeletenodetrimtypedavatoolsObject.definePropertyeslintpluginvalidatorhashflattenweakmap-0shrinkwrapsignalwindowsscheme-validationdirwrapsideio-tsECMAScript 2017speedeventDispatcherstatelessnegative zeroECMAScript 2018nodejsconnectfolderbyteclassessetImmediatefinduptouchgenericstrimLeftwaapifunctionUint8ArrayramdaemitgroupByJSON-Schemargblesscssprototypees7ECMAScript 2023ES2019harmonyES2015superstructthroatsymbolclonecolumnslazyconsoleObjectworkerreact-hooksenderapolloeventspoint-freehigher-orderassertincludestaskcollection.es6equalbrowserregular expressionvaluesgetPrototypeOfperformanceapibrowserslistreact-hook-formwalkingopenssetPrototypeOfdataECMAScript 2015datastructurees2016queuextermprivate datahttpestreephonematchesdataViewsomeURLSearchParamsFloat32ArraycliremovelimitawesomesaucehandlersimportcircularrandomtranspileslotBigUint64Arraypromisescssanimationgdprhooksprogresselectroniterationcode pointsinstallermatchbannerwatchingpersistentcontainsloadinglruawaitlooki18ntoobjectjson-schemalesspackage.jsontapeduplexsyntaxerrores6file systemlinkloggingtypesafedeepuppreserve-symlinksiteratordompromisecommandreactutilityreact posexhrmakepnpm9rmdirassertstime@@toStringTagcall-boundString.prototype.matchAllUint16Arraystreamreducerobjectjsonpathdescriptorsidleparentslintoutputpropertiesgetintrinsicwatchframeworkextraenumerablemrulockfile
1.0.0

11 days ago