- Add Strike API credentials configuration - Implement Strike node with 9 resources (Account, Balance, Currency Exchange, Deposit, Invoice, Payment, Payment Method, Payout, Rates) - Add comprehensive operation descriptions for all resources - Include CLAUDE.MD documentation - Set up build configuration with TypeScript, ESLint, and Prettier 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
847 B
JavaScript
36 lines
847 B
JavaScript
"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
|
|
});
|
|
};
|