Syllabus/themes/piratecare/node_modules/postcss-functions/dist/lib/helpers.js

23 lines
568 B
JavaScript
Raw Normal View History

2020-03-05 04:10:52 +00:00
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isPromise = isPromise;
exports.hasPromises = hasPromises;
exports.then = then;
function isPromise(obj) {
return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
}
function hasPromises(arr) {
return arr.some(function (item) {
return isPromise(item);
});
}
function then(promiseOrResult, onFulfilled) {
if (isPromise(promiseOrResult)) return promiseOrResult.then(onFulfilled);
return onFulfilled(promiseOrResult);
}