install gulp

This commit is contained in:
2018-05-28 13:26:25 +02:00
parent 2de92c908b
commit 04fab6ba46
8032 changed files with 709336 additions and 3100 deletions
@@ -0,0 +1,19 @@
"use strict";
var ensurePlainFunction = require("../../object/ensure-plain-function")
, ensureThenable = require("../../object/ensure-thenable")
, microtaskDelay = require("../../function/#/microtask-delay");
module.exports = function (callback) {
ensureThenable(this);
ensurePlainFunction(callback);
// Rely on microtaskDelay to escape eventual error swallowing
this.then(
microtaskDelay.call(function (value) {
callback(null, value);
}),
microtaskDelay.call(function (reason) {
callback(reason);
})
);
};
+5
View File
@@ -0,0 +1,5 @@
"use strict";
module.exports = {
asCallback: require("./as-callback")
};
@@ -0,0 +1,3 @@
{
"globals": { "Promise": true }
}
+6
View File
@@ -0,0 +1,6 @@
"use strict";
module.exports = {
"#": require("./#"),
"lazy": require("./lazy")
};
+38
View File
@@ -0,0 +1,38 @@
"use strict";
var isFunction = require("../function/is-function");
module.exports = function (executor) {
var Constructor;
if (isFunction(this)) {
Constructor = this;
} else if (typeof Promise === "function") {
Constructor = Promise;
} else {
throw new TypeError("Could not resolve Promise constuctor");
}
var lazyThen;
var promise = new Constructor(function (resolve, reject) {
lazyThen = function (onSuccess, onFailure) {
if (!hasOwnProperty.call(this, "then")) {
// Sanity check
throw new Error("Unexpected (inherited) lazy then invocation");
}
try {
executor(resolve, reject);
} catch (reason) {
reject(reason);
}
delete this.then;
return this.then(onSuccess, onFailure);
};
});
return Object.defineProperty(promise, "then", {
configurable: true,
writable: true,
value: lazyThen
});
};