@ts-common/iterator
Advanced tools
Comparing version 0.0.20 to 0.0.21
export declare function iterable<T>(createIterator: () => Iterator<T>): Iterable<T>; | ||
export declare function map<T, I>(input: Iterable<I>, func: (v: I, i: number) => T): Iterable<T>; | ||
export declare function forEach<T>(input: Iterable<T>, func: (v: T, i: number) => void): void; | ||
export declare function filterMap<T, I>(input: Iterable<I>, func: (v: I, i: number) => T | undefined): Iterable<T>; | ||
@@ -4,0 +5,0 @@ export declare function filter<T>(input: Iterable<T>, func: (v: T) => boolean): Iterable<T>; |
@@ -20,2 +20,10 @@ "use strict"; | ||
exports.map = map; | ||
function forEach(input, func) { | ||
let i = 0; | ||
for (const v of input) { | ||
func(v, i); | ||
++i; | ||
} | ||
} | ||
exports.forEach = forEach; | ||
function filterMap(input, func) { | ||
@@ -22,0 +30,0 @@ function* iterator() { |
{ | ||
"name": "@ts-common/iterator", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "Iterator library for JavaScript and TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17687
155