1.0.0 • Published 1 year ago

@devtea2025/distinctio-molestiae-ea-necessitatibus v1.0.0

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

@devtea2025/distinctio-molestiae-ea-necessitatibus 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 @devtea2025/distinctio-molestiae-ea-necessitatibus

Usage/Examples

var flat = require('@devtea2025/distinctio-molestiae-ea-necessitatibus');
var assert = require('assert');

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

assert.deepEqual(flat(arr, 1), [1, 2, 3, [4]]);
var flat = require('@devtea2025/distinctio-molestiae-ea-necessitatibus');
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('@devtea2025/distinctio-molestiae-ea-necessitatibus');
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

readableconsumeiterationboundwaitStreamsfunctionalArrayBuffer.prototype.slicedirectoryArray.prototype.findLastIndexdirfluxmatchAllstyleexecutableECMAScript 5includespostcssESFloat64ArraymodulesES2019islookmulti-packagelistenersURLSearchParamspushroute53genericses-abstractqsfixed-widtheslintpluginRegExp#flagsRFC-6455reduceestreeomithasOwnPropertyl10neventsstringifierutilitiescloudfrontcmdrequirecolumnsclass-validator.envurlsInt8Arrayrm -frglobalsmkdirsBigInt64Arrayresolveprefixswftrimmatchsymlinkscompilereast-asian-widthconfigurableexecopychromiumES8speedschemesuperagentsameValueZeroECMAScript 2018jasmineelasticacheString.prototype.matchAllMicrosoftmonorepoes8everynegativeES2015packagepreserve-symlinksform-validationwordwraplinuxfullopenscharactercss lesslengthmobileiteratorstoragegatewayrmprogressObject.keyscommanderArray.prototype.flatMapwaftddsinatracallbindshellslicesetterphonerangeerrorvalidateutiljsonpathtelephoneenvairbnbmkdiroperating-systemfindupassertionless.jsdebugpromisesagentsigtermECMAScript 2015ArrayBuffer#slicethrottle@@toStringTages2016immutableIteratortrimEndterminterruptskoreanextensionassertautoprefixernoperegular expressionsperformant0tc39eslintconfigtimeES2018nameexpressionasyncprototypeenvironmentslessconsoleasciipredictableconfigdescriptorsjsdiffduplexbuffersparentponyfilloptimizerwidthnodejsloadingCSSformscloneyupURLhookformbatchwraphandlersflatMapargparseBigUint64ArraynumberES7mochadebuggerxtermsignalcachemappackagesauthweboffsetbluebirdJSON-SchemasetPrototypeOfAsyncIteratorObject.getPrototypeOfgradients cssgroupprotobuftaketyped arraymimetypesweaksetes-shimscall-bindfilelivecoloures2018String.prototype.trimdescriptionmomentless mixinstapeUint32Arrayerror-handlingindicatorlanguagebreakarktypeobjectcloudsearchlinks3namesES6cloudformationCSSStyleDeclarationjavascriptrmdirrest-0sorthardlinkscorecryptostylingbytebootstrap cssreusecss nestingloggingglobalfull-widthsymlinkfast-deep-copypasswordjsdomspecperformanceidxdgreact-testing-librarybcryptdefinePropertynativeargvless compileres6RxJSArray.prototype.containsObject.valuestaskiampolyfillamazonwatchsigintflattenworkspace:*diffawsecmascripthelpersvarses-shim APIWebSocketseventDispatcherexitastECMAScript 2023ArrayslotdatevisualSymbol.toStringTagredactcommandfindLastIndexArrayBufferextendobjreduxreplayargsRegExp.prototype.flagsECMAScript 2019descriptorpreprocessorarraysgetoptwgetprotoInt32Arraypropnodespinnerskeysvariables in cssremovereact-hook-formhasES2021parsingtestjsxlogwriteinputchineselesscssframeworkWeakMapconcatMapvestttydeepJSONrdslaunchtostringtagmixinsWebSocketECMAScript 6redux-toolkitstartArray.prototype.findLastcss-in-jsvpccomputed-typescodestypesequalitydataviewieirqclistyleswordbreakwebsitees5lazychannelcallboundes2015bootstrap lessUnderscorereadablestreamjesttypedstatetypeerrorESnextaccessibilityimmerES2016arrayObjectsettingsinvariantpnpm9getOwnPropertyDescriptorformatcomparemkdirpdayjsstyled-componentslastES3fpsquerystreamtoobjecttypescriptgetPrototypeOftoolkitbddhttpsglobfindLastefficientfolderguidtrimRightdeepcopya11ychromebrowsersharedoncetslibthroatshebangoptimistpropertiesvalidlruintrinsicdropparserrapidsessyntaxjsonwalkingfile systemexpressnested cssdeterministictypanionlook-upeslint-pluginsuperstructcurlentriesauthenticationiteratedatafunctionreal-timebrowserslisturlsortedTypeBoxartrgbECMAScript 7ReactiveXec2symbolsflagscloudtrailtsdependency managerfastratelimitpackage managerPushexeccharacterscolorselmstructuredClonesymbolapptoArraytypeofES2023io-tszerocontainscollection.es6Mapwatcherreact-hooksshamfseventsObservabletraverseinternalavafunctionsStreamprocessfastcopydefineFloat32ArrayisConcatSpreadableprotocol-buffersbyteLengthdomfastifyObservablesserializerRxsqsreadtypesafecode pointsimportexportserializationstatuswhatwgcss variablestylesheetjapaneseECMAScript 2017make dirsequenceprivateinstallerclassnamestringifyfastclonestreams2classesgroupByUint8Arrayhigher-ordersignalsArray.prototype.filterSetECMAScript 2016es7unicodeweakmapfind-upUint16Arrayrecursivecorssetloadbalancing__proto__arraybufferbundlingcoercibleregularvaluesyntaxerrorpersistentcirculartestingspinnerzodtypedarrayUint8ClampedArraymatchesTypeScriptstyleguidemacosECMAScript 3hotuninstallArray.prototype.includesrequestregextypeFunction.prototype.namelibphonenumberapiextrafullwidthlockfileawesomesaucedotenvhttpfetchchildprettymoduleECMAScript 2022streamseventEmitterhasOwn[[Prototype]]emrbusydeep-clonelimitedargumentdom-testing-librarysnswarningpromisegdprloggerutilityinObject.isless cssimportReactiveExtensionscommand-linetouchcryptrandomworkercolorObject.fromEntriessideECMAScript 2020viewpatherrorhooksassignmime256flatstableregexpoutputspawnscheme-validationcloudwatch
1.0.0

1 year ago