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) {
|
return _toString.call(v) === '[object RegExp]'
|
}
|
|
export function toFixed(value, bit) {
|
const num = Math.pow(10, bit);
|
return Math.round(value * num) / num;
|
}
|
|
const _toString = Object.prototype.toString
|