File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -450,7 +450,18 @@ const defaultMethods = {
450
450
return result ? buildState . compile `!(${ result } )` : false
451
451
}
452
452
} ,
453
- merge : ( arrays ) => ( Array . isArray ( arrays ) ? [ ] . concat ( ...arrays ) : [ arrays ] ) ,
453
+ merge : ( args ) => {
454
+ if ( ! Array . isArray ( args ) ) return [ args ]
455
+ const result = [ ]
456
+ for ( let i = 0 ; i < args . length ; i ++ ) {
457
+ if ( Array . isArray ( args [ i ] ) ) {
458
+ for ( let j = 0 ; j < args [ i ] . length ; j ++ ) {
459
+ result . push ( args [ i ] [ j ] )
460
+ }
461
+ } else result . push ( args [ i ] )
462
+ }
463
+ return result
464
+ } ,
454
465
every : createArrayIterativeMethod ( 'every' ) ,
455
466
filter : createArrayIterativeMethod ( 'filter' , true ) ,
456
467
reduce : {
Original file line number Diff line number Diff line change 58
58
},
59
59
"result" : 149212 ,
60
60
"description" : " Max with Logic Chaining (Complex)"
61
+ },
62
+ {
63
+ "description" : " Addition Chained w/ Merge" ,
64
+ "rule" : { "+" : { "merge" : [{ "val" : " x" }, { "val" : " y" }] }},
65
+ "result" : 6 ,
66
+ "data" : { "x" : [1 , 2 ], "y" : 3 }
61
67
}
62
68
]
You can’t perform that action at this time.
0 commit comments