diff options
author | ztplz <mysticzt@gmail.com> | 2018-10-20 00:12:36 +0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-10-19 12:12:36 -0400 |
commit | 7210e7b33b84382d4f418ab1be37fea85c2e1422 (patch) | |
tree | f7dcb6d486d3b451fc12c3357ff2e48e4dde3ab0 /js/util.ts | |
parent | 198fa31ec150b069dca39b94b2049d3ff65213e9 (diff) |
Make fetch header compliant with the current spec (#1019)
Diffstat (limited to 'js/util.ts')
-rw-r--r-- | js/util.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/js/util.ts b/js/util.ts index 0c50acebb..0d2049842 100644 --- a/js/util.ts +++ b/js/util.ts @@ -125,3 +125,22 @@ export function deferred(): Deferred { reject: reject! }; } + +/** Create a IterableIterator. */ +// @internal +export class CreateIterableIterator<T> implements IterableIterator<T> { + private readonly _iterators: IterableIterator<T>; + readonly [Symbol.toStringTag] = "Iterator"; + + constructor(iterators: IterableIterator<T>) { + this._iterators = iterators; + } + + [Symbol.iterator](): IterableIterator<T> { + return this; + } + + next(): IteratorResult<T> { + return this._iterators.next(); + } +} |