All files utils.js

0% Statements 0/20
0% Branches 0/22
0% Functions 0/4
0% Lines 0/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46                                                                                           
"use strict";
/*
 * @Author: lijianzhang
 * @Date: 2018-08-29 21:36:27
 * @Last Modified by: lijianzhang
 * @Last Modified time: 2018-08-29 21:37:18
 */
exports.__esModule = true;
/**
 * @param {any} fn
 */
function isFunction(fn) {
    return typeof fn === 'function';
}
exports.isFunction = isFunction;
/**
 * 是否是基本类型
 * @param {*any} value
 */
function isPrimitive(value) {
    if (value === null || value === undefined) {
        return true;
    }
    if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean' || value instanceof Date) {
        return true;
    }
    return false;
}
exports.isPrimitive = isPrimitive;
function invariant(cond, message) {
    if (message === void 0) { message = 'Illegal state'; }
    if (!cond)
        throw new Error("[liob-error] " + message);
}
exports.invariant = invariant;
function isObservableObject(obj) {
    // 判断是否否可作为数据源
    if (Array.isArray(obj))
        return true;
    if (!obj || obj.toString() !== '[object Object]' || obj.nodeType || obj.setInterval) {
        return false;
    }
    return true;
}
exports.isObservableObject = isObservableObject;