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