First version

This commit is contained in:
Senad Uka
2023-07-05 11:02:15 +02:00
parent f21c24b599
commit 8eabf79994
4052 changed files with 723968 additions and 232443 deletions

View File

@@ -0,0 +1,23 @@
'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);
}