1.0.0 • Published 1 year ago

@tea062024/officia-ratione-nostrum v1.0.0

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

@tea062024/officia-ratione-nostrum 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 @tea062024/officia-ratione-nostrum

Usage/Examples

var flat = require('@tea062024/officia-ratione-nostrum');
var assert = require('assert');

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

assert.deepEqual(flat(arr, 1), [1, 2, 3, [4]]);
var flat = require('@tea062024/officia-ratione-nostrum');
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('@tea062024/officia-ratione-nostrum');
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

styleguideIteratorECMAScript 2015fileECMAScript 2023ES8computed-typesformglobalformsmappatchjshintdatastructurethrottleflaginputecmascriptbundlingoptimizerprivate dataextenduninstallserializerlibphonenumberexitloadingrangeerrorES2020superagentObservablesvaluestylebeanstalkstringifiercryptdefinees-abstractgetOwnPropertyDescriptortrimStartjsonpathcliUint8ArrayaccessorconfigfluxUnderscoreECMAScript 2019watchFileenumerablevarsemitfast-copyRFC-6455corschaifast-deep-copysharedarraybufferintrinsicgroupsetPrototypeOfcss variablextermcodeses2017lengthcloudsearchpreserve-symlinksargvchromiumgetqueueMicrotaskfsprunetouchworkflowfull-widthpackagesettingsBigInt64Arrayswfglobstringbusyrestfulmapreduceawaitrecursiveinvariantreactes2016elmconsumeES5pnpm9es8Object.entrieszodloggerrequirevpcbufferscommanderpathpushfastcloneRegExp#flagsdirectoryes7cloudwatchcss lesstoSortedimportexportvisualdatejavascriptflatMapassertsreal-timesignalswatcher.envsymlinksauthenticationexecstreams2objshrinkwrapextraomitreadablestreamgetPrototypeOfes2015packagescloudfrontes2018TypedArrayjasmineloadbalancinginternallimitedarktypelastutilitynumbervalidationkarmaAsyncIteratorbyteLengthhelperslogtypedarraysjsspeednegative zeroObject.isdataViewcolumnfastenderclassesspinnerfunctionswaitweakmaptrimLeftpreprocessorhas-ownimmutable$.extendastpredictablestatusansiless.jsconcatescapeECMAScript 2021endpointshebangwordwrapcolorsconnecterror-handlingflagsequalityrouterguiddropemrvestbundlerautoscalingfile systemReflect.getPrototypeOfFloat64ArraymomentES2023io-tsimportmimetypesines-shimscore-jsspinnersbrowserlistmonorepoesappkeyskeymoveeventEmitterarraysbindArray.prototype.findLastIndexindicatordeepcopyCSSStyleDeclarationwatchingoptimistArray.prototype.flatMapfast-deep-clonesettermiddlewareECMAScript 6eslintconfigyupregular expressionArrayBuffer.prototype.sliceproppyyamltaskrgbECMAScript 2020widthinferencechinesereact-testing-library0ratelimitwhichshimscheme-validationcolourloggingpostcssECMAScript 5picomatchforEachsigtermbddwhatwgfindLastIndexextensionttydynamodbregexbannerhashnope[[Prototype]]regexpnodehasOwnnpmconfigurablenativeRxJSmacosebssnsfastifyoperating-systemes6Promiserequestdirdependency managerbootstrap lessSymbol.toStringTagES2016mkdircontainsESwritestarterrapidMicrosofttermcharacteropenUint8ClampedArraytslibrfc4122apicallbindquerysigintassignFunction.prototype.namehascss-in-jsfixed-widthObject.valuesschemeunicodeframeworkObservablebluebirdroute53positivewebi18ncallquerystringES2022reduceESnextcode pointsstreamUint32ArrayinterruptsSymbolreadflattencommandpostcss-pluginECMAScript 2016browserlesscssserializeArray.prototype.containsreact-hook-forminstallercreatewarningencryptionrm -rffiglettypeduuidmakelinewrapserializationprettyrandomairbnbString.prototype.trimjestWebSocketdeepclonesesstatelesscircularsafeiteratestatetypanionbyteRxObject.fromEntrieskoreanutilclassnameHyBierrorpasswordenvironmentiteratorratedescriptorminimalwrapjwtgetoptstyled-componentsassertionidentifierssearchwgeteslintqscommand-linelistenerswritablecollection.es6JSON-SchemaFloat32Arraylanguagedeleteowndescriptiondom-testing-libraryshellenvStreamargparsebuffercss nestingArray.prototype.includesestreelessObjectroutesidetelephoneclassnamesES6arrayexpressiontoStringTagflatconcatMaplook-upslicestringifyES2015deep-copyshamauthMap@@toStringTagpolyfillfetchrmvariablesgradients css3eventDispatcheraccessibilityparsequoteJSONlookfullliveformatcall-bindCSStoolsgdprexpressfpsmime-dbreadablecryptomruagentassertES2021takeclass-validatortrimtypeerrorhttpsfindArray.prototype.filtergetintrinsicduplexsymlinksetkinesispackage.jsonfunctioncjkutil.inspect-0matchestyped arrayfast-cloneoffsetRegExp.prototype.flagsiterationdeep-clonedompackage managerelectronmoduleslockfileartinstallprotocol-buffersrdsparserelasticacheruntimetapreducermatchstylesheetargsimmerInt8ArraybyteOffsetzerogradients cssdescriptorsfastcopyjsonroutingsharedArray.prototype.flattenTypeScriptefficientString.prototype.matchAllwafchromepromiseswalktypescriptcheckvaluesphonetimeidleviewjsxremoveECMAScript 3form-validationsymbolprogresscallbackprototypeincludescallboundtypedarraybatchnested cssdebuggerprivatel10ntc39tsrm -frfromTypeBoxsortiegettermkdirstrimRightsyntaxerrormatchAllstylestypehandlerscollectionReactiveExtensionsreact-hooksajvsequencetestperformantglobalsajaxcurlbcrypttypessymbolsidwindowsupprocessglacierargumentparentsECMAScript 2022definePropertyarraybufferreplaydatagroupBystablenodejsequalxhrcloudtraillinkyamlcoresignalcompareeventstypesafebounddeterministicnameES7regularfindLastStreamstddtypeofmimestylingstoragegatewayjQueryreusebreaktrimEndYAMLlintlazyoptionfullwidthnamesprotobufconcurrencyirqwalkinges5lrucompile lessweakseteverystructuredCloneECMAScript 7toArraymetadatacsssuperstructcompilereast-asian-width_.extendredux-toolkitcolumnsWeakMaprestObject.assignhigher-orderschemavariables in csstestingasciiworkspace:*WebSocketsinspectenvironmentsArrayfind-upisConcatSpreadablecensorfiltercloneless compilerchannelArray.prototype.findLasthooksprotoavahotfolderinternal slotawsjsdomsetImmediatemkdirpless css256joifindupECMAScript 2017asyncfseventsArrayBuffertoolkitoutputmodulesinatrasortedconsolesimpledbproxylinuxStyleSheet
1.0.0

1 year ago