"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const pLimit = require("p-limit");
/**
 * Save promises for later
 */
function memoize(concurrency) {
    const locks = {};
    const limit = pLimit(concurrency);
    return function (key, fn) {
        if (locks[key])
            return locks[key];
        locks[key] = limit(fn);
        return locks[key];
    };
}
exports.default = memoize;
//# sourceMappingURL=memoize.js.map