export class ArrayUtil { public static toStringArray ( value ) { if ( Array . isArray ( value ) ) { return value . slice ( ) ; } if ( typeof value === 'string' ) { return value . trim ( ) . split ( /\s*[;,]\s*/ ) ; } return null ; } public static toArray ( value ) { if ( Array . isArray ( value ) ) { return value . slice ( ) ; } return [ value ] ; } public static isFilledStringArray ( arr ) { if ( ! arr || ! Array . isArray ( arr ) ) { return false ; } for ( let element of arr ) { if ( typeof element !== 'string' || element . trim ( ) === '' ) { return false ; } } return true ; } public static isEmptyArray ( value ) { return Array . isArray ( value ) && value . length === 0 ; } public static uniqConcat ( arrA , arrB ) { let arr = arrA . slice ( ) ; arrB . forEach ( ( element ) => { if ( arr . indexOf ( element ) < 0 ) { arr . push ( element ) ; } } ) ; return arr ; } public static subtractArray ( arrA , arrB ) { return arrA . slice ( ) . filter ( element => arrB . indexOf ( element ) === - 1 ) ; } }