"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.filter = filter;
exports.objectAllPromise = objectAllPromise;
exports.getDeferred = getDeferred;
const _ = require("lodash");
async function filter(array, test) {
    let testResults = await Promise.all(array.map(test));
    return array.filter((v, i) => testResults[i]);
}
async function objectAllPromise(obj) {
    return _.zipObject(Object.keys(obj), await Promise.all(Object.values(obj)));
}
function getDeferred() {
    let resolveCallback;
    let rejectCallback;
    let result = new Promise((resolve, reject) => {
        resolveCallback = resolve;
        rejectCallback = reject;
    });
    result.resolve = resolveCallback;
    result.reject = rejectCallback;
    return result;
}
//# sourceMappingURL=promise.js.map