@hoangcung1804npm/magnam-doloribus-minima

1.0.0 • Public • Published

@hoangcung1804npm/magnam-doloribus-minima 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 @hoangcung1804npm/magnam-doloribus-minima

Usage/Examples

var findLastIndex = require('@hoangcung1804npm/magnam-doloribus-minima');
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('@hoangcung1804npm/magnam-doloribus-minima');
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('@hoangcung1804npm/magnam-doloribus-minima');
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

Readme

Keywords

Package Sidebar

Install

npm i @hoangcung1804npm/magnam-doloribus-minima

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

18.9 kB

Total Files

8

Last publish

Collaborators

  • hoangcung1804