"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.composeRevivers = composeRevivers;
exports.objectWithBigNumberReviver = objectWithBigNumberReviver;
const BigNumberUtils_1 = require("./BigNumberUtils");
const TypeGuards_1 = require("./TypeGuards");
function composeRevivers(...revivers) {
    revivers = revivers.filter(TypeGuards_1.isDefined);
    return (key, value) => revivers.reduce((acc, reviver) => reviver(key, acc), value);
}
function objectWithBigNumberReviver(_, value) {
    if (value === null || typeof value !== "object") {
        return value;
    }
    const resolvedValue = value;
    return resolvedValue.type === "BigNumber" ? (0, BigNumberUtils_1.toBN)(resolvedValue.hex) : resolvedValue;
}
//# sourceMappingURL=ReviverUtils.js.map