UNPKG

soot-shared

Version:
88 lines (84 loc) 2.1 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var NO_OP = "$NO_OP"; var ERROR_MSG = "Error"; var isArray = Array.isArray; function isStatefulComponent(o) { return !isUndefined(o.prototype) && !isUndefined(o.prototype.render); } function isStringOrNumber(o) { var type = typeof o; return type === "string" || type === "number"; } function isNullOrUndef(o) { return isUndefined(o) || isNull(o); } function isInvalid(o) { return isNull(o) || o === false || isTrue(o) || isUndefined(o); } function isFunction(o) { return typeof o === "function"; } function isString(o) { return typeof o === "string"; } function isNumber(o) { return typeof o === "number"; } function isNull(o) { return o === null; } function isTrue(o) { return o === true; } function isUndefined(o) { return o === void 0; } function isObject(o) { return typeof o === "object"; } /** * Throws error * @param {string?} message */ function throwError(message) { if (!message) { message = ERROR_MSG; } throw new Error("Soot Error: " + message); } function warning(message) { // tslint:disable-next-line:no-console console.warn(message); } function combineFrom(first, second) { var out = {}; if (first) { for (var key in first) { out[key] = first[key]; } } if (second) { for (var key in second) { out[key] = second[key]; } } return out; } exports.NO_OP = NO_OP; exports.ERROR_MSG = ERROR_MSG; exports.isArray = isArray; exports.isStatefulComponent = isStatefulComponent; exports.isStringOrNumber = isStringOrNumber; exports.isNullOrUndef = isNullOrUndef; exports.isInvalid = isInvalid; exports.isFunction = isFunction; exports.isString = isString; exports.isNumber = isNumber; exports.isNull = isNull; exports.isTrue = isTrue; exports.isUndefined = isUndefined; exports.isObject = isObject; exports.throwError = throwError; exports.warning = warning; exports.combineFrom = combineFrom;