iterator-helper
Advanced tools
Comparing version 1.1.3 to 1.2.0
@@ -13,2 +13,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./ItHelper"), exports); | ||
__exportStar(require("./wrappers"), exports); | ||
__exportStar(require("./iterator"), exports); | ||
__exportStar(require("./async-iterator"), exports); |
{ | ||
"name": "iterator-helper", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -79,21 +79,2 @@ # iterator-helper | ||
## Generators helpers | ||
If you have some (a)sync generators, you can wrap them with the appropriate wrapper: | ||
```ts | ||
import { wrap, awrap } from 'iterator-helper'; | ||
function* generateNumbers() { | ||
yield 1; | ||
yield* [2, 3, 4]; | ||
} | ||
// wrap for sync generators, awrap for async generators. | ||
generateNumbers = wrap(generateNumbers); | ||
// It works! | ||
generateNumbers().filter(e => e % 2 === 0).toArray(); | ||
``` | ||
## API | ||
@@ -150,5 +131,5 @@ | ||
findIndex(callback: (value: T) => boolean) : number; | ||
/** Only works if it. is a number iterator. Returns the maximum of iterator. */ | ||
/** Only works if it is a number iterator. Returns the maximum of iterator. */ | ||
max() : number; | ||
/** Only works if it. is a number iterator. Returns the minimum of iterator. */ | ||
/** Only works if it is a number iterator. Returns the minimum of iterator. */ | ||
min() : number; | ||
@@ -155,0 +136,0 @@ /** When iterator ends, go back to the first item then loop. Indefinitively. */ |
@@ -29,3 +29,3 @@ { | ||
"strict": true, /* Enable all strict type-checking options. */ | ||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ | ||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ | ||
// "strictNullChecks": true, /* Enable strict null checks. */ | ||
@@ -32,0 +32,0 @@ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ |
118744
17
2876
194