commonUtil.js 428 Bytes
Newer Older
wb-ct393452's avatar
wb-ct393452 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
export function isDef(v) {
    return v !== undefined && v !== null;
}

/**
 * Remove an item from an array.
 */
export function remove(arr, item) {
    if (arr.length) {
        const index = arr.indexOf(item);
        if (index > -1) {
            return arr.splice(index, 1);
        }
    }
}

export function isRegExp(v) {
18
    return _toString.call(v) === '[object RegExp]';
wb-ct393452's avatar
wb-ct393452 committed
19 20 21
}

const _toString = Object.prototype.toString;