1.0.0 • Published 1 year ago

@diotobtea/minima-et v1.0.0

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

@diotobtea/minima-et Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ESnext spec-compliant Array.prototype.findLastIndex 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.findLastIndex 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 @diotobtea/minima-et

Usage/Examples

var findLastIndex = require('@diotobtea/minima-et');
var assert = require('assert');

var arr = [1, [2], [], 3, [[4]]];
var isNumber = function (x) { return typeof x === 'number' };

assert.deepEqual(findLastIndex(arr, isNumber), 3);
var findLastIndex = require('@diotobtea/minima-et');
var assert = require('assert');
/* when Array#findLastIndex is not present */
delete Array.prototype.findLastIndex;
var shimmed = findLastIndex.shim();

assert.equal(shimmed, findLastIndex.getPolyfill());
assert.deepEqual(arr.findLastIndex(isNumber), findLastIndex(arr, isNumber));
var findLastIndex = require('@diotobtea/minima-et');
var assert = require('assert');
/* when Array#findLastIndex is present */
var shimmed = findLastIndex.shim();

assert.equal(shimmed, Array.prototype.findLastIndex);
assert.deepEqual(arr.findLastIndex(isNumber), findLastIndex(arr, isNumber));

Tests

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

mockingasteriskslook-up__proto__JSON-SchematacitrecursivedescriptorES2016Array.prototype.containsESstylesgetOwnPropertyDescriptornegativepropertiesidspinnersslotparenttimeenvironmentsastgdpryupUint32Arrayfileprettya11ytesterweakmapclassesformsfetchCSSStyleDeclarationloggertoSortedutilitiesrangeerrorlistenersflagrapidmulti-packageignoreenvironmentfastclonevalidtransportnumbercore0code pointspureregular expressionsES2017istanbuldeepsymlinksslicetyped arrayservicemochaacornendercolouravaextendprivate dataspeedmake dirredux-toolkitprotocol-buffersoffsethas-owntoolkitpreprocessorenvvisualruntimeTypeScriptimportexportieuser-streamsECMAScript 6TypeBoxupaccessibilityclassnamesbrowserlistFloat32Arrayanimationoptionwalkingconfigdom-testing-libraryArray.prototype.findLastIndexintrinsicgetPrototypeOfeffect-tsmoduleiteratormatchestraverseendpointsymboldebuggerRFC-6455ES2020ttyrequestpoint-freenativeconvertponyfillES2019regular expressionspringspinnerpatchredactbrowserslistowncompilerchineseESnextguidcssclass-validatorpluginkey valuecryptoreduceAsyncIteratoreventEmitterInt16Arraygenericsapollocore-jselasticacheeslint-pluginutilfpwarningmatchAlljasminesuperstruct[[Prototype]]sidesimpledbstarterinputredirectcharsetMicrosoftnpmignorelengthpnpm9rgbyamlworkflowreal-timeerrorroute53immeriteratees7rssvarsstylingURLbufferswriteclientdynamodbfeedentriesES2015symbolsomitInt8ArrayphoneprogressES2021Array.prototype.flattrimStartglobalstypeerrorawsstreamansinodeES8protocheckstylesettingssameValueZeroregularECMAScript 2019reworkCSSArray.prototype.flattenswfArrayBuffer.prototype.slicebyteLengthprotobufgraphqlstyled-componentssnstextincludescolorrequireinternalreact-testing-libraryES2023valueqssettersharedarraybufferbyteOffsetReactiveExtensionsbinddefinePropertyjsontelephonereact posecolumnsthreePushJSONshamcommand-lineec2package.jsonshrinkwraploggingObjectkeysetPrototypeOfES3joischematypeflagsArray.prototype.includesECMAScript 2016es2017fastcopyforminstallECMAScript 2021utilityflatdayjswafcollection.es6dateartfile cachetoArrayshellmonorepoargumentassertionasserturltsqueryconfigurableserializercliECMAScript 2023argstypedarraysinternal slottakeobjectnpmsyntaxes6hasOwnreact animationasciiroutezerodirpostcss-pluginfull256hookseslintconfigpropcurriedrdstermtypesafeeverychromiumprototypesubprocesspromiselockfileidentifiersconsolefastarraypolyfillsyntaxerrorpinostringifiercallawesomesaucefsspawntypanioncharacterstrimRightArray.prototype.filtercjkatomjestrestRegExp.prototype.flagsajvObservablesautoscalingdeep-copyresolveequalityassignviewmakebundlersortpopmotionisConcatSpreadable$.extendstringifymapreducedataViewfilterrm -rfescapeisUint8ClampedArraypathECMAScript 2020colorsmatchmkdirindicatorflatMaprestfulstyleguideconcatineslintautoprefixerreversedarraysES2022unicodermdirhookformRxJS
1.0.0

1 year ago