function-tree
Version:
When a function is not enough
21 lines (20 loc) • 899 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isPlainValue = isPlainValue;
exports.isPromise = isPromise;
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
/*
If it walks like a duck and quacks like a duck...
*/
function isPromise(result) {
return result && (result instanceof Promise || typeof result.then === 'function' && typeof result["catch"] === 'function');
}
function isPlainValue(value) {
if (value !== null && _typeof(value) === 'object' && !Array.isArray(value) && value.constructor !== Object) {
return false;
}
return true;
}
//# sourceMappingURL=utils.js.map