Skip to content

Commit

Permalink
Use for...of instead of each() in disposable and update generated API
Browse files Browse the repository at this point in the history
  • Loading branch information
afshin committed Aug 15, 2022
1 parent ec648c0 commit 0da98e4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
1 change: 0 additions & 1 deletion packages/disposable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"watch": "tsc --build --watch"
},
"dependencies": {
"@lumino/algorithm": "^1.9.1",
"@lumino/signaling": "^1.10.1"
},
"devDependencies": {
Expand Down
10 changes: 4 additions & 6 deletions packages/disposable/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
|
| The full license is in the file LICENSE, distributed with this software.
|----------------------------------------------------------------------------*/
import { each } from '@lumino/algorithm';

import { ISignal, Signal } from '@lumino/signaling';

/**
Expand Down Expand Up @@ -198,9 +196,9 @@ export namespace DisposableSet {
*/
export function from(items: Iterable<IDisposable>): DisposableSet {
let set = new DisposableSet();
each(items, item => {
for (const item of items) {
set.add(item);
});
}
return set;
}
}
Expand Down Expand Up @@ -250,9 +248,9 @@ export namespace ObservableDisposableSet {
*/
export function from(items: Iterable<IDisposable>): ObservableDisposableSet {
let set = new ObservableDisposableSet();
each(items, item => {
for (const item of items) {
set.add(item);
});
}
return set;
}
}
22 changes: 11 additions & 11 deletions review/api/algorithm.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@ export namespace ArrayExt {
}

// @public
export function chain<T>(...objects: Iterable<T>[]): Generator<T, void, unknown>;
export function chain<T>(...objects: Iterable<T>[]): IterableIterator<T>;

// @public
export function each<T>(object: Iterable<T>, fn: (value: T, index: number) => boolean | void): void;

// @public
export function empty<T>(): Generator<never, void, unknown>;
export function empty<T>(): IterableIterator<T>;

// @public
export function enumerate<T>(object: Iterable<T>, start?: number): Generator<(number | T)[], void, unknown>;
export function enumerate<T>(object: Iterable<T>, start?: number): IterableIterator<[number, T]>;

// @public
export function every<T>(object: Iterable<T>, fn: (value: T, index: number) => boolean): boolean;

// @public
export function filter<T>(object: Iterable<T>, fn: (value: T, index: number) => boolean): Generator<T, void, unknown>;
export function filter<T>(object: Iterable<T>, fn: (value: T, index: number) => boolean): IterableIterator<T>;

// @public
export function find<T>(object: Iterable<T>, fn: (value: T, index: number) => boolean): T | undefined;
Expand All @@ -77,7 +77,7 @@ export interface IRetroable<T> {
}

// @public
export function map<T, U>(object: Iterable<T>, fn: (value: T, index: number) => U): Generator<U, void, unknown>;
export function map<T, U>(object: Iterable<T>, fn: (value: T, index: number) => U): IterableIterator<U>;

// @public
export function max<T>(object: Iterable<T>, fn: (first: T, second: T) => number): T | undefined;
Expand All @@ -89,10 +89,10 @@ export function min<T>(object: Iterable<T>, fn: (first: T, second: T) => number)
export function minmax<T>(object: Iterable<T>, fn: (first: T, second: T) => number): [T, T] | undefined;

// @public
export function once<T>(value: T): Generator<T, void, unknown>;
export function once<T>(value: T): IterableIterator<T>;

// @public
export function range(start: number, stop?: number, step?: number): Generator<number, void, unknown>;
export function range(start: number, stop?: number, step?: number): IterableIterator<number>;

// @public
export function reduce<T>(object: Iterable<T>, fn: (accumulator: T, value: T, index: number) => T): T;
Expand All @@ -101,7 +101,7 @@ export function reduce<T>(object: Iterable<T>, fn: (accumulator: T, value: T, in
export function reduce<T, U>(object: Iterable<T>, fn: (accumulator: U, value: T, index: number) => U, initial: U): U;

// @public
export function repeat<T>(value: T, count: number): Generator<T, void, unknown>;
export function repeat<T>(value: T, count: number): IterableIterator<T>;

// @public
export function retro<T>(object: IRetroable<T> | ArrayLike<T>): IterableIterator<T>;
Expand All @@ -110,7 +110,7 @@ export function retro<T>(object: IRetroable<T> | ArrayLike<T>): IterableIterator
export function some<T>(object: Iterable<T>, fn: (value: T, index: number) => boolean): boolean;

// @public
export function stride<T>(object: Iterable<T>, step: number): Generator<T, void, unknown>;
export function stride<T>(object: Iterable<T>, step: number): IterableIterator<T>;

// @public
export namespace StringExt {
Expand All @@ -126,13 +126,13 @@ export namespace StringExt {
}

// @public
export function take<T>(object: Iterable<T>, count: number): Generator<T, void, unknown>;
export function take<T>(object: Iterable<T>, count: number): IterableIterator<T>;

// @public
export function topologicSort<T>(edges: Iterable<[T, T]>): T[];

// @public
export function zip<T>(...objects: Iterable<T>[]): Generator<any[], void, unknown>;
export function zip<T>(...objects: Iterable<T>[]): IterableIterator<T[]>;

// (No @packageDocumentation comment for this package)

Expand Down

0 comments on commit 0da98e4

Please sign in to comment.