1.0.2 • Published 1 year ago

@juigorg/et-voluptates v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@juigorg/et-voluptates 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 @juigorg/et-voluptates

Usage/Examples

var flatMap = require('@juigorg/et-voluptates');
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('@juigorg/et-voluptates');
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('@juigorg/et-voluptates');
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

classnamefindLastglobal objecttermapp.gitignorerangeerrorECMAScript 2018rmdirmergesidenumbertelephoneschemecurriedinternalgroupBypackagereact-hooksmake diroutputObject.fromEntriesreducemodulesuninstallpackagesforEachpostcss-pluginmatchAllbinarynopeimmutableECMAScript 2020prefixUnderscorees-shimsURLSearchParamsdeepcopycallbind$.extendspecreverseparsetapObject.assignenvironmentdeepanimationbannerwindowTypeBoxthreeassertroutingistanbulaccessibilityserializereact-testing-librarysetjasminetransformes2018assignworkercreatespawnhashformsdiffenderbufferzxcoloursinatraproxymoveES7spinnerscallbackreadlibphonenumberharmonyrm -frfastifywebreduxzerofunctioncloudsearchxtermtoReversedglobalparentscolorefficientartserializertypedoptimistserializationprivate dataregular-expressionhooksbabel-corewalkingeventsreadablestreamasyncreal-timelengthwaitwriteregexprettyECMAScript 7scheme-validationfnmatchUint16ArrayinferencechildajaxworkflowasciiReactiveExtensionsyamlmulti-packagecoreflattenslotemojicallpolyfillwarningdirlook-upJSON-Schematest-0momentString.prototype.trimtranspileemitdirectoryponyfill[[Prototype]]propertybyteOffsettrimStartutil.inspectIteratorsharedarraybufferhasOwnPropertySystem.globalESnextmkdirsshamkoreanshrinkwrapwritableconcatMappoint-freepostcssesnativemonorepogetOwnPropertyDescriptoridentifierslastTypeScriptcode pointscsselectronESguidhttps3damazonspinnerletinstallermanagerclipnpm9ttyrapidRxJSarraysquerystringweakmapeffect-tsexecutereducercheckparenttacitpicomatchECMAScripttesterCSSStyleDeclarationfsredacthas-owninArray.prototype.flatawsjsdompromisemrutypedarraysjesterrorcoverageperformancestylees-shim APIstableexecstringmetadataspeedECMAScript 2022equalsafestyled-componentsflagdataViewbusyextrasearchbinariesecmascriptcommanderautoscalingsetterestreesqsdefineBigInt64Arraygitignorecallboundcomputed-typesWeakMaptextdependenciesvpcdeep-copyeslintpluginpackage.json.envdescriptionobjinternal slotECMAScript 5consolefast-deep-clonedescriptorsinstalltoStringTagpackage managerstreamsYAMLperformantprivatearraybuffersuperagentfindupconsumeeveryfile systemconfigregular expressionschromeloadbalancingbundlingvaluesortedArrayBuffer#sliceArray.prototype.includesutilsexpressioncurlreact animationrouterframeworkES2019cloudwatchiamECMAScript 2021tddcontainsrobustjsxswfdescriptortrimEndasterisksArray.prototype.filterstringifyrm -rfnodejsfind-uploggergdprObject.getPrototypeOfECMAScript 2015fetchescapetraversegenericsjshintairbnbcharactersSymbol.toStringTagrandomdependency managerrssmkdir6to5weaksetlrustoragegatewaylocationbyteLengthInt32ArrayrgbwhatwgcloudformationFloat64Arraychannelclientcommand-lineReactiveXvisualreact-hook-formurlfilterwgetsymbolbrowserfastclonestructuredCloneFunction.prototype.namees6core-jsreact poseArray.prototype.flatMapES2018atomMapmkdirpRegExp.prototype.flagsregularfastECMAScript 6Reflect.getPrototypeOfbinredirectslicexhrtouchhtmlqueueES5shimzodoptioncloudtrailObjectboundjavascriptindicatoreventEmittertostringtagcircularclass-validatorWeakSettyped arrayunicodetypedarraydeletemapreducePushmochaisarrayObservableECMAScript 2017css-in-jspropertiescodesruntimefpproppureajvtypesafeelbrmcloneJSONminimalprogresses2015ansibufferstypescriptutilignorematchfpstoobjectObject.iscensormakejsformattingfeedacornWebSocketspositivefull-widthjson-schema-validation0toolkitchromiumkinesiselasticachecall-boundemr__proto__columnssimpledbnpmStyleSheetnegative zerocryptodataviewsymbolsglobal this valueutilityStreams@@toStringTagdotenvargsowntranspilernamelanguageidlebrowserslistargumentroute53logpopmotionviewsameValueZeroES2021ielintES2017varsjson-schema-validatorexpressnpmignoresomeuuidTypedArrayfullwidthvalidURLUint32Arraytypeerrorcall-bindselffantasy-landroutestringifierpatchcacheassertscharacteryupObject.definePropertyqueueMicrotaskes7regular expressionES3shareddom-testing-libraryhasOwnSymboljsonArraybrowserlistrequestAsyncIteratorflagsbindprocesskeyArray.prototype.containsdebugmodulees8debuggerfast-cloneUint8ArrayjQueryrecursiveworkspace:*settingsnodesetImmediatevaluesshebangimporteventDispatcherES2015ECMAScript 2016constio-tsincludeschinesefoldertslibclassesdefinePropertysetPrototypeOfSetbundlertypeofdynamodbapolloec2joifindLastIndexprotokeysRegExp#flagsenumerableArrayBufferreusesuperstructhardlinkswalkbeanstalksnstrimLeftargveslintdeepclonejsdiffstyleguidebabelframerregexpmobileresolveoptimizerBigUint64Arraysymlinksa11yObject.entrieslistenerstypesimportexportgroupdomiddeep-clonedatees2017reworkArray.prototype.flattengesturesisConcatSpreadableRFC-6455qscompilerfiletakeuser-streamsquotetoArrayWebSocketterminalconcatprototypedeterministicuptestingpluginsortcommandfast-deep-copyObservablesFloat32Arraycjkstyleshttploadingeslintconfigfullutilitiesstylingequalitys3formfunctionalvarflattransportECMAScript 2023waapicoercibletypekarmafunctionscollectionassertionconfigurablehigher-orderpiperdsaccessorlocalmanipulationwafrfc4122inputeast-asian-widthes5json-schemagetterredux-toolkitgetreactString.prototype.matchAllgetintrinsicebsrulescolorsramdarestfindtc39
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago