Skip to content
This repository was archived by the owner on Oct 19, 2019. It is now read-only.

Commit ffb9d43

Browse files
committed
added JSDoc
1 parent 63a7d04 commit ffb9d43

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/extensions.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ interface Array<T> {
66
flatMap<TResult>(lambda: (e: T) => TResult[]): TResult[];
77
}
88

9+
/**
10+
* @param str The string against which to match the regular expression.
11+
* @return An array containing the results of the RegExp.prototype.exec method until no match is found.
12+
*/
913
RegExp.prototype.execAll = function(str: string): any[] {
1014
const arr: any[] = [];
1115
let tmp;
@@ -19,8 +23,13 @@ RegExp.prototype.execAll = function(str: string): any[] {
1923
return arr;
2024
};
2125

26+
/**
27+
* @param callback Function that produces an Array, taking three arguments.
28+
* @param thisArg Value to use as this when executing callback.
29+
* @return A new array with each element being the flattened result of the callback function.
30+
*/
2231
Array.prototype.flatMap = function<T1, T2>(
23-
lambda: (currentValue: T1, index: number, array: T1[]) => T2[],
32+
callback: (currentValue: T1, index: number, array: T1[]) => T2[],
2433
thisArg?: any): T2[] {
25-
return Array.prototype.concat.apply([], this.map(lambda, thisArg));
34+
return Array.prototype.concat.apply([], this.map(callback, thisArg));
2635
};

0 commit comments

Comments
 (0)