utils/parsing.js
function toArrayOrUndefined(str) {
    if (validation.isArray(str) && str.length < 1) {
        return undefined;
    }

    try {
        let parsedArray = str;

        if (typeof str !== 'object') {
            parsedArray = JSON.parse(str);
        }

        if (validation.isArray(parsedArray) && parsedArray.length > 0) {
            return parsedArray;
        }
        else {
            return undefined;
        }
    }
    catch (e) {
        return undefined;
    }
}
function toArrayOrUndefined(str) {
    if (validation.isArray(str) && str.length < 1) {
        return undefined;
    }

    try {
        let parsedArray = str;

        if (typeof str !== 'object') {
            parsedArray = JSON.parse(str);
        }

        if (validation.isArray(parsedArray) && parsedArray.length > 0) {
            return parsedArray;
        }
        else {
            return undefined;
        }
    }
    catch (e) {
        return undefined;
    }
}
function toArrayOrUndefined ( str ) { if ( validation . isArray ( str ) && str . length < 1 ) { return undefined ; } try { let parsedArray = str ; if ( typeof str !== 'object' ) { parsedArray = JSON . parse ( str ) ; } if ( validation . isArray ( parsedArray ) && parsedArray . length > 0 ) { return parsedArray ; } else { return undefined ; } } catch ( e ) { return undefined ; } }
Receives anything and parses it into an array. If it is a stringified array, it
gets parsed, stringified and returned; if it is not either of these, it returns undefined

@param {*} str
@returns {[]|undefined}
Receives anything and parses it into an array . If it is a stringified array it gets parsed stringified and returned ; if it is not either of these it returns undefined