import _ = require("lodash"); import { MaybePromise } from "@httptoolkit/util"; export async function filter( array: T[], test: (t: T) => MaybePromise ): Promise { let testResults = await Promise.all(array.map(test)); return array.filter((v, i) => testResults[i]); } export async function objectAllPromise(obj: _.Dictionary>): Promise<_.Dictionary> { return _.zipObject(Object.keys(obj), await Promise.all(Object.values(obj))); }