Refresh master with initial release/0.24 snapshot (#332)

* Initial port of release/0.24 source code

* Fix additional headers

* Fix a typo in launch.json
This commit is contained in:
Karl Burtram
2017-12-15 15:38:57 -08:00
committed by GitHub
parent 271b3a0b82
commit 6ad0df0e3e
7118 changed files with 107999 additions and 56466 deletions

View File

@@ -5,11 +5,15 @@
'use strict';
export interface IIterator<T> {
export interface IIterator<E> {
next(): { done: boolean, value: E };
}
export interface INextIterator<T> {
next(): T;
}
export class ArrayIterator<T> implements IIterator<T> {
export class ArrayIterator<T> implements INextIterator<T> {
private items: T[];
protected start: number;
@@ -73,16 +77,16 @@ export class ArrayNavigator<T> extends ArrayIterator<T> implements INavigator<T>
}
export class MappedIterator<T, R> implements IIterator<R> {
export class MappedIterator<T, R> implements INextIterator<R> {
constructor(protected iterator: IIterator<T>, protected fn: (item: T) => R) {
constructor(protected iterator: INextIterator<T>, protected fn: (item: T) => R) {
// noop
}
next() { return this.fn(this.iterator.next()); }
}
export interface INavigator<T> extends IIterator<T> {
export interface INavigator<T> extends INextIterator<T> {
current(): T;
previous(): T;
parent(): T;