asynciterator-promiseproxy
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -11,3 +11,4 @@ import { AsyncIterator, TransformIterator, TransformIteratorOptions } from "asynciterator"; | ||
constructor(sourceGetter: () => Promise<AsyncIterator<T>>, options?: TransformIteratorOptions<T>); | ||
loadSource(): Promise<AsyncIterator<T>>; | ||
_read(count: number, done: () => void): void; | ||
} |
@@ -15,6 +15,11 @@ "use strict"; | ||
} | ||
async loadSource() { | ||
if (!this.source) { | ||
this.source = await this.sourceGetter(); | ||
} | ||
return this.source; | ||
} | ||
_read(count, done) { | ||
if (!this.source) { | ||
this.sourceGetter().then((source) => { | ||
this.source = source; | ||
this.loadSource().then((source) => { | ||
super._read(count, done); | ||
@@ -21,0 +26,0 @@ }).catch((error) => this.emit('error', error)); |
{ | ||
"name": "asynciterator-promiseproxy", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "An AsyncIterator proxy that allows its source to be set via a promise.", | ||
@@ -30,10 +30,10 @@ "main": "index.js", | ||
"@types/asynciterator": "^1.1.1", | ||
"@types/jest": "^21.1.8", | ||
"@types/jest": "^24.0.1", | ||
"coveralls": "^3.0.0", | ||
"jest": "^21.2.1", | ||
"jest": "^23.4.1", | ||
"pre-commit": "^1.2.2", | ||
"ts-jest": "^21.2.3", | ||
"ts-jest": "^24.0.0", | ||
"tslint": "^5.8.0", | ||
"tslint-eslint-rules": "^4.1.1", | ||
"typescript": "^2.6.2" | ||
"tslint-eslint-rules": "^5.3.1", | ||
"typescript": "^3.0.3" | ||
}, | ||
@@ -47,3 +47,3 @@ "pre-commit": [ | ||
"transform": { | ||
"^.+\\.ts$": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
"^.+\\.ts$": "ts-jest" | ||
}, | ||
@@ -58,4 +58,3 @@ "transformIgnorePatterns": [ | ||
], | ||
"collectCoverage": true, | ||
"mapCoverage": true | ||
"collectCoverage": true | ||
}, | ||
@@ -62,0 +61,0 @@ "scripts": { |
@@ -5,3 +5,3 @@ # Async Promise Proxy Iterator | ||
[![Coverage Status](https://coveralls.io/repos/github/rubensworks/asynciterator-promiseproxy.js/badge.svg?branch=master)](https://coveralls.io/github/rubensworks/asynciterator-promiseproxy.js?branch=master) | ||
[![npm version](https://badge.fury.io/js/asynciterator-promiseproxy.svg)](https://www.npmjs.com/package/asynciterator-promiseproxy) | ||
[![npm version](https://badge.fury.io/js/asynciterator-promiseproxy.svg)](https://www.npmjs.com/package/asynciterator-promiseproxy) [![Greenkeeper badge](https://badges.greenkeeper.io/rubensworks/asynciterator-promiseproxy.js.svg)](https://greenkeeper.io/) | ||
@@ -8,0 +8,0 @@ An AsyncIterator proxy that allows its source to be set via a promise. |
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
6282
52