"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Functional_1 = require("../../../../Class/Functional");
const object_1 = require("../../../../util/object");
const _ids_1 = require("../../../_ids");
class DeepGet extends Functional_1.Functional {
    constructor(system) {
        super({
            i: ['obj', 'path'],
            o: ['value'],
        }, {}, system, _ids_1.ID_DEEP_GET);
    }
    f({ obj, path }, done, fail) {
        let value;
        try {
            value = (0, object_1.deepGet)(obj, path);
            if (value === undefined) {
                throw new Error('key not found');
            }
        }
        catch (err) {
            fail('key not found');
            return;
        }
        done({
            value,
        });
    }
}
exports.default = DeepGet;
//# sourceMappingURL=index.js.map