"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cacheResolvedValue = cacheResolvedValue;
const common_1 = require("@inversifyjs/common");
function cacheResolvedValue(binding, resolvedValue) {
    if ((0, common_1.isPromise)(resolvedValue)) {
        binding.cache = {
            isRight: true,
            value: resolvedValue,
        };
        return resolvedValue.then((syncResolvedValue) => cacheSyncResolvedValue(binding, syncResolvedValue));
    }
    return cacheSyncResolvedValue(binding, resolvedValue);
}
function cacheSyncResolvedValue(binding, resolvedValue) {
    binding.cache = {
        isRight: true,
        value: resolvedValue,
    };
    return resolvedValue;
}
//# sourceMappingURL=cacheResolvedValue.js.map