export function merge ( a , b ) { if ( ! a && ! b ) { throw new Error ( 'Please specify valid arguments for parameters a and b.' ) ; } if ( ! b || b . length === 0 ) { return a ; } if ( ! a || a . length === 0 ) { return b ; } if ( Object . prototype . toString . call ( a ) !== Object . prototype . toString . call ( b ) ) { throw new Error ( 'The types of the two arguments passed for parameters a and b do not match.' ) ; } const c = new a . constructor ( a . length + b . length ) ; c . set ( a ) ; c . set ( b , a . length ) ; return c ; }