source: imaps-frontend/node_modules/array.prototype.findlast/README.md

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 3.0 KB
Line 
1# array.prototype.findlast <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
3[![github actions][actions-image]][actions-url]
4[![coverage][codecov-image]][codecov-url]
5[![dependency status][deps-svg]][deps-url]
6[![dev dependency status][dev-deps-svg]][dev-deps-url]
7[![License][license-image]][license-url]
8[![Downloads][downloads-image]][downloads-url]
9
10[![npm badge][npm-badge-png]][package-url]
11
12An ESnext spec-compliant `Array.prototype.findLast` shim/polyfill/replacement that works as far down as ES3.
13
14This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the proposed [spec](https://tc39.es/proposal-array-find-from-last).
15
16Because `Array.prototype.findLast` depends on a receiver (the `this` value), the main export takes the array to operate on as the first argument.
17
18## Getting started
19
20```sh
21npm install --save array.prototype.findlast
22```
23
24## Usage/Examples
25
26```js
27var findLast = require('array.prototype.findlast');
28var assert = require('assert');
29
30var arr = [1, [2], [], 3, [[4]]];
31var isNumber = function (x) { return typeof x === 'number' };
32
33assert.deepEqual(findLast(arr, isNumber), 3);
34```
35
36```js
37var findLast = require('array.prototype.findlast');
38var assert = require('assert');
39/* when Array#findLast is not present */
40delete Array.prototype.findLast;
41var shimmed = findLast.shim();
42
43assert.equal(shimmed, findLast.getPolyfill());
44assert.deepEqual(arr.findLast(isNumber), findLast(arr, isNumber));
45```
46
47```js
48var findLast = require('array.prototype.findlast');
49var assert = require('assert');
50/* when Array#findLast is present */
51var shimmed = findLast.shim();
52
53assert.equal(shimmed, Array.prototype.findLast);
54assert.deepEqual(arr.findLast(isNumber), findLast(arr, isNumber));
55```
56
57## Tests
58Simply clone the repo, `npm install`, and run `npm test`
59
60[package-url]: https://npmjs.org/package/array.prototype.findlast
61[npm-version-svg]: https://versionbadg.es/es-shims/Array.prototype.findLast.svg
62[deps-svg]: https://david-dm.org/es-shims/Array.prototype.findLast.svg
63[deps-url]: https://david-dm.org/es-shims/Array.prototype.findLast
64[dev-deps-svg]: https://david-dm.org/es-shims/Array.prototype.findLast/dev-status.svg
65[dev-deps-url]: https://david-dm.org/es-shims/Array.prototype.findLast#info=devDependencies
66[npm-badge-png]: https://nodei.co/npm/array.prototype.findlast.png?downloads=true&stars=true
67[license-image]: https://img.shields.io/npm/l/array.prototype.findlast.svg
68[license-url]: LICENSE
69[downloads-image]: https://img.shields.io/npm/dm/array.prototype.findlast.svg
70[downloads-url]: https://npm-stat.com/charts.html?package=array.prototype.findlast
71[codecov-image]: https://codecov.io/gh/es-shims/Array.prototype.findLast/branch/main/graphs/badge.svg
72[codecov-url]: https://app.codecov.io/gh/es-shims/Array.prototype.findLast/
73[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Array.prototype.findLast
74[actions-url]: https://github.com/es-shims/Array.prototype.findLast
Note: See TracBrowser for help on using the repository browser.