1.3.14 • Published 1 year ago

@hishprorg/optio-incidunt v1.3.14

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

@hishprorg/optio-incidunt 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 @hishprorg/optio-incidunt

Usage/Examples

var flat = require('@hishprorg/optio-incidunt');
var assert = require('assert');

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

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

debuges2017Array.prototype.includesloggingnativermdirguidsubprocessreversedtraversecomputed-typesexecfileES2019rgbStreamssortxhrastconstsqsemojiSystem.globalYAMLdependency managercss-in-jsarraybuffermatchvalueRFC-6455ReactiveExtensionsfastcloneString.prototype.trimTypeBoxspeedparentses8execfunctionsextra6to5cloneuuidbrowserslistcjkmatchescallboundgenericsvalidatees7full-widthsuperstructpurelocalpropertiesregular expressionsrestfulfiltergetpreprocessorrouteres-shim APIworkervest-0linteffect-tsIteratorfullvpcObject.definePropertyglobal this valuecompilersimpledbcreateCSSconfigtranspileasynchasOwnPropertycharacterhigher-orderglobalebsbrowserspinnersreducefast-copywhatwgforkspringreal-timecolumnchildisreuserulesglobal objecthas-ownstoragegatewayjoiswfuser-streamsvarschromeargvprogresspinoreact-testing-librarytesterReflect.getPrototypeOftypeerrorawscode pointsidentifiersreadableArrayBufferxtermexecuteECMAScript 5mapsafeframeworkthreecommand-linekarmaarktypegdprMicrosoftconcatglobalsieconsumejsxcoerciblevalidsymlinkspromisebeanstalkbrowserlistWeakMappopmotionpackagefsramdanamecommand.gitignorepropertypropisConcatSpreadableemrtypeanimationbyteLengthformattingecmascriptmomentcall-boundrapidansicallbackutilitymakecollectionHyBimanagerpushregexentriescore-jsArray.prototype.flatMapprettynegative zeroes-shimses2018syntaxrmes2016dotenvflagsagentrm -frinvariantio-tsgetopttc39keywalktslibtacitintrinsic$.extenddeepcopylibphonenumberArray.prototype.findLastIndexfile systemcolorRegExp.prototype.flagsomiterrorpackagesjestlanguagecurltoArrayoutputeventEmitterArrayInt32ArraylistenerscallbindECMAScript 2017functionalWeakSettoolkithooksimmeres2015rangeerrorESstyled-componentsfinduppositiveoptionWebSocket@@toStringTagreadhardlinksutilitieslooktrimEndES7eslintpluginpyyamltrimfindLastIndextrimLeftglobalThisvisualstylingfeedweaksetrestscheme-validationsinatraES2021BigUint64ArraycharactersreactfastoptimistspinnerreverseRxJSenvinspectpnpm9koreanparserflattextsnsdragutilsfullwidtheslint0validatoridincludesbindemitassignfunction.lengthschemastringifiercall-bindletfindLastwindowboundCSSStyleDeclarationgetOwnPropertyDescriptorredux-toolkitUint8ClampedArraytransformclass-validator[[Prototype]]prefixdayjstypedArray.prototype.flattenbabellrutddtypanionstructuredCloneURLargsfast-deep-copyclassnamesObject.getPrototypeOfinferencenumberi18nMapfnmatchdescriptionjasmineredirectworkspace:*styleguideprocessjsdiffregexpinternal sloteveryurlfetchqslengthwidthdataviewreworkespreesameValueZerohookformdropfptouchartrdsbinariesqueueMicrotaskrequestenderwritedatauninstallbabel-coreArray.prototype.flatjson-schemanpmignoreyupmoduleECMAScript 2019lastavaES3airbnbacornbufferviewdom-testing-libraryUnderscoreJSONrobustkinesisunicodedebuggercoreiamtypedarraysuphashexpresspostcssnamesArrayBuffer#slicees6webxmlimmutableequaliteratorprotoWebSocketsStreamECMAScript 2018cloudtrailquerystringmkdirsmatchAllefficientshrinkwrapformsrandoml10nprivate256accessibilityperformantdateiteratedescriptorbuffersSymbol.toStringTagrouteTypedArrayconsoletelephonearraystestingfpsponyfillObject.entriesdeep-copycloudformationECMAScript 7environmentlook-upqueryformasciisyntaxerrorECMAScript 2023testfixed-widthlocationUint32Arraygraphqlreact-hook-formglacierchannelfind-uptostringtagmergewaapichaisomekeyssettranspilerpipecurriedasterisksECMAScript 2020fast-deep-clonetapcollection.es6defineelbgesturescolumnstransportcolorsassertreadablestreamgetintrinsicjson-schema-validatorES2016cachefast-cloneestreeassertsdeepcloneajaxchromiumwalkingES2015json-schema-validationAsyncIteratoreast-asian-widthtoobjecttstapemochacloudsearchloadbalancingformatUint8ArraybinreducertypesatomString.prototype.matchAllvariablesrequirejavascriptdiffcoverageproxyinstrumentationbannerObject.assigncolourES2020onceRegExp#flagssettertypesafetypescriptdataViewSymbolInt8Arrayinstallerjsdomparseshimclientsesfastifyterminalnpmprotobufrm -rfECMAScript 2015framermovedeterministicspawnhttpsUint16Arrayeslint-pluginfantasy-landmetadataa11yobjectsetImmediatetermweakmapECMAScript 3resolveFloat32ArrayinternalinawesomesaucevarstringshellextendJSON-SchemaeventsredactArray.prototype.containsECMAScript 6spechasOwnconfigurablebundlerstreamsPushstringifyarraywritables3side
1.3.14

1 year ago

1.3.13

1 year ago

1.3.12

1 year ago

1.3.11

1 year ago

1.3.10

1 year ago

1.3.9

1 year ago

1.3.8

1 year ago

1.3.7

1 year ago

1.3.6

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago