1.0.0 • Published 11 days ago

@drtyhu8npm/quod-consequatur-pariatur v1.0.0

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

@drtyhu8npm/quod-consequatur-pariatur Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES2019 spec-compliant Array.prototype.flat 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 proposed spec.

Because Array.prototype.flat 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 @drtyhu8npm/quod-consequatur-pariatur

Usage/Examples

var flat = require('@drtyhu8npm/quod-consequatur-pariatur');
var assert = require('assert');

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

assert.deepEqual(flat(arr, 1), [1, 2, 3, [4]]);
var flat = require('@drtyhu8npm/quod-consequatur-pariatur');
var assert = require('assert');
/* when Array#flat is not present */
delete Array.prototype.flat;
var shimmedFlat = flat.shim();

assert.equal(shimmedFlat, flat.getPolyfill());
assert.deepEqual(arr.flat(), flat(arr));
var flat = require('@drtyhu8npm/quod-consequatur-pariatur');
var assert = require('assert');
/* when Array#flat is present */
var shimmedIncludes = flat.shim();

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

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

Tests

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

busyreadablestreamwaitnameregexparrayisPushcsscss variablefetchassignjapanesemobilevalidatecheckloggingirqpropertyexitdataviewObjecttoStringTaglintasciistartunicodees7iesuperstructworkermiddlewareAsyncIteratorrangeerrordeterministicflatspawnobjecttraverseoptimistdayjsES3keyscss nestingcorereduceres-shimstranspilerdirectoryconfigxdg-openInt16ArrayObject.valuescli256validatorMicrosoftbindaccessibilitytesting-0boundutilitiestouchmkdirfindLaststylesYAMLencryptionReactiveExtensionschromiumcallboundjsdomWebSocketsxssgenericsgraphqlfantasy-landsetterbufferUint32ArraytimespeedfindECMAScript 2016pnpm9someObject.entriesfast-clonevalidationvarlesscssgradients csseditorwatchiterateredactinspectTypeBoxObservableszodes8clientpersistentwarningsetImmediateserializationES2017sideObject.assignregular expressionsdiffwordbreakless.jssanitizationuuidrandomless cssbyteLengthtslibPromiseJSONsymbolcallbackjsxpositivescheme-validationreact-hook-formlinewrapstringifytoSortedTypedArrayhookformargvless compilercolumnsmakeRegExp.prototype.flagsInt8ArrayquoteidfigleteventDispatcherjwtmoveformatcolorform-validationsortedsetPrototypeOfinstallparentslazyfastcopyconfigurablearraybufferECMAScript 5descriptor0react pose3dshrinkwrapiterationfunctionsequencecallnodesigtermsortes2015metadatacall-bindreduxserializercommandES2020arktypelinkbrowserliststringbabelinvariantcorseslinthasOwnmapcollection.es6dropgradients css3ponyfillwhatwgtrimpicomatchdeep-clonedeep-copyrm -rfes-abstracterrorBigUint64ArrayflagsshellfunctionsrobustdirnumberomitpasswordutilsescapeextensionArrayBuffer#slicehelpersdependency managerECMAScript 2015prunebabel-coretermposesettingsobjexit-codeES8typesmixinsjoijQuerycurlrfc4122tddES2022privatees2018logeventseslintpluginloading_.extendbannerutil.inspectvaluessyntaxerrorinferenceletcodestrimEndlaunchoperating-systemequalairbnbinstallernegativedeepworkspace:*argparseargumenturlsSetminimalfullansistylingRxJScompilerexecutableObservablekeythroatstyleyamlpropl10npluginsanitizenegative zeroa11yqueuetaskstreamspringinternal slotsyntaxlastawesomesaucewalkingresolvesameValueZeroupgetapicharacterspathdatastructurenativeECMAScript 2021queueMicrotaskprivate datajsdiffargumentstapeUint16ArraygrouphooksexeclassnameFloat64Arraydragshimfrominputfilterapollomime-dbextendframerfull-widthchrometypedyupflagstyled-componentsrgbloggerRxES2021CSSStyleDeclarationsetstylesheetfunctionalfast-deep-cloneargsnamesxhropenshardlinkscontainstypaniondefinePropertyxdgawaitwhichkoreanterminalArrayBuffer.prototype.sliceJSON-SchemaimmertestervisuallibphonenumberreusemacosECMAScript 7Array.prototype.flatMapstreamsES2023cryptstyleguideinterruptsspinnercolorsvariables in css.envartcommand-linearraystoolkitstreams2chinesetakeexpressionprototypenopeHyBifolderECMAScript 2018descriptionpoint-freeprotoeast-asian-widthtc39consoleprotobufhigher-orderinternalflatMapes2016ES2016classesdom-testing-libraryclassnamesfileqsjsviewArray.prototype.findLastcachecirculardeletecss-in-jsSymbol.toStringTagreadES2019ajvcensoresArray.prototype.containsecmascriptpackage.jsonefficientframeworkdatecommanderwgetvariablesintrinsicenvironmentgetOwnPropertyDescriptorautoprefixerUnderscoretelephoneastInt32ArrayObject.fromEntriesdebugavasignalssuperagentredux-toolkitcallbindcoloursigintreal-timepostcss-pluginjsonpathECMAScript 2022rmdirlook-upphoneindicatorESnextchildassertionString.prototype.trimbuffersregularenderformoptiondeepcloneparsercharacterbreakpipeassertsiteratorArrayBufferconcurrencyeslintconfigReactiveXES2015connecturlprogressmochapackagepreserve-symlinksArray.prototype.flatreadableratelimitjsonSymboltypeofObject.isclonehttpsmodulesharmonybundlerpreprocessortypeESArray.prototype.flattenutilityconsumegdprfses-shim APIauthenticationfast-deep-copytoobjectprotocol-buffersfaststatuscompile lessnpmautheventEmitterreact animationzeroES2018duplexjest__proto__json-schema-validatorreactlimitsharedarraybufferhaswebpushURLprettyeveryxtermdataViewregexpuresafegesturesenumerableRegExp#flagsbluebirdpostcssRFC-6455writablefind-upbootstrap cssES5ECMAScript 2020lengthlessstabletestsymlinksECMAScript 6collectionchaitapArray.prototype.includesreact-hooksimmutableentriesfpformattingmkdirstoArrayttyparsehttpbrowsermatchAlltyped arrayvalidrm -frcmddescriptorsString.prototype.matchAllextralruhandlersweakmaphashBigInt64ArraystructuredClonevestwebsitelinuxdataremoveTypeScriptjsonschemajson-schemastarterECMAScript 2023tssliceregular expressionquerysymlinkrmpatchsearchrapidconstes2017i18npromiseReflect.getPrototypeOffindLastIndexfile systemeslint-pluginFloat32ArrayspectypescriptwatchFileObject.keyscoerciblespinnerstacitcolumnasyncfixed-widthlanguageschemebrowserslisttypedarraybatchperformantbcryptpackage managerArray.prototype.findLastIndexStyleSheetoffsetpolyfillObject.definePropertyemojiforEachsignalArray.prototype.filterdefineassertcurriedfastclonepopmotionio-tsbundlingURLSearchParamsclass-validatorWeakSetemitajaxidlestateless@@toStringTagObject.getPrototypeOfECMAScript 2017outputperformanceflattenequalitycopyArraymoduleconcatMapoptimizermonorepochannelprocessutilstringifieruninstallwindowsWebSocketbddramdadebuggerexpressaccessorcomputed-typessharedWeakMapkarmamomenttypesafecore-jsFunction.prototype.namejavascriptbyteOffsetStreamtools6to5ratenodejsincludesnested csstostringtagtrimStartenverror-handlingwidthcss lesscryptoshammkdirpopenelectronbootstrap lessimportMapwalkmulti-packagelookmatchescompareECMAScript 3Uint8ClampedArrayECMAScript 2019less mixinstextdomlistenersgetopttypedarrayses6serializeshebangprefixglobrecursivethreedependencieslockfilerequestES7writeguidappsymbolstrimLeftgroupByisConcatSpreadableslotpropertiespyyamlwatcherestreetypeerrorjasmineconcatdeepcopyformsuser-streamses5waapimake dir
1.0.0

11 days ago