This repository was archived by the owner on Oct 19, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff 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+ */
913RegExp . 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+ */
2231Array . 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} ;
You can’t perform that action at this time.
0 commit comments