Gathering detailed insights and metrics for es6-iterator
Gathering detailed insights and metrics for es6-iterator
Gathering detailed insights and metrics for es6-iterator
Gathering detailed insights and metrics for es6-iterator
@thi.ng/bitstream
ES6 iterator based read/write bit streams with support for variable word widths
@neoxr/thing-bitstream
ES6 iterator based read/write bit streams with support for variable word widths
iterator-matcher
Easily found out if an ES6 Iterator match what you expected
es-get-iterator
Get an iterator for any JS language value. Works robustly across all environments, all versions.
npm install es6-iterator
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
18 Stars
95 Commits
9 Forks
5 Watching
1 Branches
3 Contributors
Updated on 30 Jun 2021
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-0.3%
1,901,100
Compared to previous day
Last week
4.6%
10,477,692
Compared to previous week
Last month
16.8%
41,331,157
Compared to previous month
Last year
-8.3%
453,553,373
Compared to previous year
3
4
$ npm install es6-iterator
To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: Browserify, Webmake or Webpack
Abstract Iterator interface. Meant for extensions and not to be used on its own.
Accepts any list object (technically object with numeric length property).
Mind it doesn't iterate strings properly, for that use dedicated StringIterator
1var Iterator = require('es6-iterator') 2var iterator = new Iterator([1, 2, 3]); 3 4iterator.next(); // { value: 1, done: false } 5iterator.next(); // { value: 2, done: false } 6iterator.next(); // { value: 3, done: false } 7iterator.next(); // { value: undefined, done: true }
Dedicated for arrays and array-likes. Supports three iteration kinds:
1var ArrayIterator = require('es6-iterator/array') 2var iterator = new ArrayIterator([1, 2, 3], 'key+value'); 3 4iterator.next(); // { value: [0, 1], done: false } 5iterator.next(); // { value: [1, 2], done: false } 6iterator.next(); // { value: [2, 3], done: false } 7iterator.next(); // { value: undefined, done: true }
May also be used for arguments objects:
1(function () { 2 var iterator = new ArrayIterator(arguments); 3 4 iterator.next(); // { value: 1, done: false } 5 iterator.next(); // { value: 2, done: false } 6 iterator.next(); // { value: 3, done: false } 7 iterator.next(); // { value: undefined, done: true } 8}(1, 2, 3));
Assures proper iteration over unicode symbols.
See: http://mathiasbynens.be/notes/javascript-unicode
1var StringIterator = require('es6-iterator/string'); 2var iterator = new StringIterator('fπoπoπ'); 3 4iterator.next(); // { value: 'f', done: false } 5iterator.next(); // { value: 'π', done: false } 6iterator.next(); // { value: 'o', done: false } 7iterator.next(); // { value: 'π', done: false } 8iterator.next(); // { value: 'o', done: false } 9iterator.next(); // { value: 'π', done: false } 10iterator.next(); // { value: undefined, done: true }
Polyfill for ECMAScript 6 for...of
statement.
var forOf = require('es6-iterator/for-of');
var result = [];
forOf('πππ', function (monkey) { result.push(monkey); });
console.log(result); // ['π', 'π', 'π'];
Optionally you can break iteration at any point:
1var result = []; 2 3forOf([1,2,3,4]', function (val, doBreak) { 4 result.push(monkey); 5 if (val >= 3) doBreak(); 6}); 7console.log(result); // [1, 2, 3];
Return iterator for any iterable object.
1var getIterator = require('es6-iterator/get'); 2var iterator = get([1,2,3]); 3 4iterator.next(); // { value: 1, done: false } 5iterator.next(); // { value: 2, done: false } 6iterator.next(); // { value: 3, done: false } 7iterator.next(); // { value: undefined, done: true }
Whether obj is iterable
1var isIterable = require('es6-iterator/is-iterable'); 2 3isIterable(null); // false 4isIterable(true); // false 5isIterable('str'); // true 6isIterable(['a', 'r', 'r']); // true 7isIterable(new ArrayIterator([])); // true
If obj is an iterable it is returned. Otherwise TypeError is thrown.
Chain multiple iterators into one.
$ npm test
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More