File tree 1 file changed +20
-17
lines changed
1 file changed +20
-17
lines changed Original file line number Diff line number Diff line change 1
- export const arrayBind = function ( arr ) {
2
- if ( typeof Array . prototype . flatMap === "function" ) {
3
- return function ( f ) {
4
- return arr . flatMap ( f ) ;
5
- } ;
6
- }
7
-
8
- return function ( f ) {
9
- const result = [ ] ;
10
- for ( let i = 0 , l = arr . length ; i < l ; i ++ ) {
11
- const xs = f ( arr [ i ] ) ;
12
- for ( let j = 0 , m = xs . length ; j < m ; j ++ ) {
13
- result . push ( xs [ j ] ) ;
14
- }
1
+ export const arrayBind =
2
+ typeof Array . prototype . flatMap === "function"
3
+ ? function ( arr ) {
4
+ return function ( f ) {
5
+ return arr . flatMap ( f ) ;
6
+ } ;
15
7
}
16
- return result ;
17
- } ;
18
- } ;
8
+ : function ( arr ) {
9
+ return function ( f ) {
10
+ var result = [ ] ;
11
+ var l = arr . length ;
12
+ for ( var i = 0 ; i < l ; i ++ ) {
13
+ var xs = f ( arr [ i ] ) ;
14
+ var k = xs . length ;
15
+ for ( var j = 0 ; j < k ; j ++ ) {
16
+ result . push ( xs [ j ] ) ;
17
+ }
18
+ }
19
+ return result ;
20
+ } ;
21
+ } ;
You can’t perform that action at this time.
0 commit comments