"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromNodeCb = void 0;
// ets_tracing: off
const core_1 = require("./core");
const effectAsync_1 = require("./effectAsync");
const fail_1 = require("./fail");
function fromNodeCb(f, __trace) {
    return function () {
        // eslint-disable-next-line prefer-rest-params
        const args = Array.prototype.slice.call(arguments);
        return (0, effectAsync_1.effectAsync)((cb) => {
            const cbResolver = (e, r) => (e != null ? cb((0, fail_1.fail)(e)) : cb((0, core_1.succeed)(r)));
            // eslint-disable-next-line prefer-spread
            f.apply(null, args.concat(cbResolver));
        }, __trace);
    };
}
exports.fromNodeCb = fromNodeCb;
//# sourceMappingURL=fromNodeCb.js.map