mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-01 17:23:35 -05:00
Merge from vscode 61d5f2b82f17bf9f99f56405204caab88a7e8747
This commit is contained in:
@@ -20,7 +20,7 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Returns an array which contains all values that reside
|
||||
* in the given set.
|
||||
* in the given dictionary.
|
||||
*/
|
||||
export function values<T>(from: IStringDictionary<T> | INumberDictionary<T>): T[] {
|
||||
const result: T[] = [];
|
||||
@@ -52,7 +52,7 @@ export function first<T>(from: IStringDictionary<T> | INumberDictionary<T>): T |
|
||||
}
|
||||
|
||||
/**
|
||||
* Iterates over each entry in the provided set. The iterator allows
|
||||
* Iterates over each entry in the provided dictionary. The iterator allows
|
||||
* to remove elements and will stop when the callback returns {{false}}.
|
||||
*/
|
||||
export function forEach<T>(from: IStringDictionary<T>, callback: (entry: { key: string; value: T; }, remove: () => void) => any): void; // {{SQL CARBON EDIT}} @anthonydresser add hard typings
|
||||
|
||||
@@ -49,7 +49,15 @@ export namespace Iterable {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function* map<T, R>(iterable: Iterable<T>, fn: (t: T) => R): IterableIterator<R> {
|
||||
export function* filter<T>(iterable: Iterable<T>, predicate: (t: T) => boolean): Iterable<T> {
|
||||
for (const element of iterable) {
|
||||
if (predicate(element)) {
|
||||
return yield element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function* map<T, R>(iterable: Iterable<T>, fn: (t: T) => R): Iterable<R> {
|
||||
for (const element of iterable) {
|
||||
return yield fn(element);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user