UNPKG

zent

Version:

一套前端设计语言和基于React的实现

20 lines (17 loc) 711 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; exports['default'] = isPromise; /** * Test whether an object looks like a promise * * @export * @param {any} obj * @returns {bool} */ function isPromise(obj) { return !!obj && ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' || typeof obj === 'function') && typeof obj.then === 'function'; } module.exports = exports['default'];