File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -450,7 +450,18 @@ const defaultMethods = {
450450 return result ? buildState . compile `!(${ result } )` : false
451451 }
452452 } ,
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+ } ,
454465 every : createArrayIterativeMethod ( 'every' ) ,
455466 filter : createArrayIterativeMethod ( 'filter' , true ) ,
456467 reduce : {
Original file line number Diff line number Diff line change 5858 },
5959 "result" : 149212 ,
6060 "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 }
6167 }
6268]
You can’t perform that action at this time.
0 commit comments