'use strict' ; export const arrayMerge = ( oldArray , newArray ) => { let flag = { } ; angular . forEach ( oldArray , ( item , index ) => { let id = item . _id ; if ( id ) { flag [ id ] = index ; } } ) ; angular . forEach ( newArray , ( item , index ) => { let id = flag [ item . _id ] ; if ( flag [ id ] >= 0 ) { angular . extend ( oldArray [ id ] , item ) ; } else { oldArray . push ( item ) ; } } ) ; return oldArray ; } ;