@slowpoison/async-utils
Advanced tools
| import { GeneratorUtils } from '@slowpoison/async-utils' | ||
| import { describe, it } from 'mocha' | ||
| // Only used for compilation against index.d.ts. No assertions needed. | ||
| describe('GeneratorUtils', () => { | ||
| it('should be defined', () => { | ||
| let lines = [ 1, 2, 3 ] | ||
| GeneratorUtils.filter(lines, (line) => line > 1) | ||
| }) | ||
| }) |
+10
-3
| declare module '@slowpoison/async-utils' { | ||
| export function first(iterable: Iterable<T>, predicate: (value: T) => boolean): T | ||
| export function *filter(iterable: Iterable<T>, predicate: (value: T) => boolean): IterableIterator<T> | ||
| export function *map(iterable: Iterable<T>, mapper: (value: T) => any): IterableIterator<T> | ||
| namespace AsyncUtils { | ||
| export class AsyncUtils { | ||
| static callbackToPromise(method, callback): Promise<any> | ||
| } | ||
| } | ||
| namespace GeneratorUtils { | ||
| export function first<T>(iterable: Iterable<T>, predicate: (value: T) => boolean): T | ||
| export function filter<T>(iterable: Iterable<T>, predicate: (value: T) => boolean): Generator<T> | ||
| export function map<T>(iterable: Iterable<T>, mapper: (value: T) => any): Generator<T> | ||
| } | ||
| } |
+2
-2
| { | ||
| "name": "@slowpoison/async-utils", | ||
| "version": "0.0.5", | ||
| "version": "0.0.6", | ||
| "description": "A set of utils for working with async code", | ||
@@ -9,3 +9,3 @@ "main": "index.cjs", | ||
| "scripts": { | ||
| "test": "mocha" | ||
| "test": "mocha && tsc --noEmit" | ||
| }, | ||
@@ -12,0 +12,0 @@ "repository": { |
5306
10.38%10
11.11%122
14.02%