Umama-at-Bluchip/Quick-UI
0
1# es-iterator-helpers <sup>[![Version Badge][npm-version-svg]][package-url]</sup>2 3[![github actions][actions-image]][actions-url]4[![coverage][codecov-image]][codecov-url]5[![License][license-image]][license-url]6[![Downloads][downloads-image]][downloads-url]7 8[![npm badge][npm-badge-png]][package-url]9 10An ESnext spec-compliant sync iterator helpers shim/polyfill/replacement that works as far down as ES3.11 12This package implements the [es-shim API](https://github.com/es-shims/api) “multi” interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-additional-properties-of-the-string.prototype-object).13 14Because the `Iterator.prototype` methods depend on a receiver (the `this` value), the main export in each subdirectory takes the string to operate on as the first argument.15 16The main export of the package itself is simply an array of the available directory names. It’s sole intended use is for build tooling and testing.17 18## Supported things19 20 - [`Iterator` constructor](https://tc39.es/proposal-iterator-helpers/#sec-iterator-constructor)21 - [`Iterator.prototype`](https://tc39.es/proposal-iterator-helpers/#sec-iterator.prototype)22 - [`Iterator.from`](https://tc39.es/proposal-iterator-helpers/#sec-iterator.from)23 - [`Iterator.prototype.constructor`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.constructor)24 - [`Iterator.prototype.drop`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.drop)25 - [`Iterator.prototype.every`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.every)26 - [`Iterator.prototype.filter`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.filter)27 - [`Iterator.prototype.find`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.find)28 - [`Iterator.prototype.flatMap`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.flatmap)29 - [`Iterator.prototype.forEach`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.foreach)30 - [`Iterator.prototype.map`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.map)31 - [`Iterator.prototype.reduce`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.reduce)32 - [`Iterator.prototype.some`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.some)33 - [`Iterator.prototype.take`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.take)34 - [`Iterator.prototype.toArray`](https://tc39.es/proposal-iterator-helpers/#sec-iteratorprototype.toarray)35 36## Getting started37 38```sh39npm install --save es-iterator-helpers40```41 42## Usage/Examples43 44```js45const map = require('es-iterator-helpers/Iterator.prototype.map');46const toArray = require('es-iterator-helpers/Iterator.prototype.toArray');47const assert = require('assert');48 49const iterator = [1, 2, 3].values();50 51const mapped = map(iterator, (x) => x + 10);52assert.deepEqual(53 mapped.next(),54 {55 done: false,56 value: 11,57 }58);59assert.deepEqual(60 toArray(mapped),61 [12, 13]62);63```64 65```js66require('./auto'); // shim all of the methods67 68require('./Iterator.prototype.map/auto'); // shim the “map” method69```70 71## Tests72Simply clone the repo, `npm install`, and run `npm test`73 74[package-url]: https://npmjs.org/package/es-iterator-helpers75[npm-version-svg]: https://versionbadg.es/es-shims/iterator-helpers.svg76[deps-svg]: https://david-dm.org/es-shims/iterator-helpers.svg77[deps-url]: https://david-dm.org/es-shims/iterator-helpers78[dev-deps-svg]: https://david-dm.org/es-shims/iterator-helpers/dev-status.svg79[dev-deps-url]: https://david-dm.org/es-shims/iterator-helpers#info=devDependencies80[npm-badge-png]: https://nodei.co/npm/es-iterator-helpers.png?downloads=true&stars=true81[license-image]: https://img.shields.io/npm/l/es-iterator-helpers.svg82[license-url]: LICENSE83[downloads-image]: https://img.shields.io/npm/dm/es-iterator-helpers.svg84[downloads-url]: https://npm-stat.com/charts.html?package=es-iterator-helpers85[codecov-image]: https://codecov.io/gh/es-shims/iterator-helpers/branch/main/graphs/badge.svg86[codecov-url]: https://app.codecov.io/gh/es-shims/iterator-helpers/87[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/iterator-helpers88[actions-url]: https://github.com/es-shims/iterator-helpers/actions89 