import {type Options} from 'p-map'; export type Mapper = ( value: ValueType, key: KeyType ) => MappedValueType | PromiseLike; /** Like [`Promise.all()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) but for `Map` and `Object`. @param input - Resolves entry values that are promises. Other values are passed through. @param mapper - Receives the current value and key as parameters. Expected to return a `Promise` or value. @param options - See the [`p-map` options](https://github.com/sindresorhus/p-map#options). @returns A promise that is fulfilled when all promises in `input` and ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is the same as `input`, but with a fulfilled version of each entry value, or the fulfilled value returned from `mapper`, if defined. @example ``` import pProps from 'p-props'; import got from 'got'; const fetch = async url => { const {body} = await got(url); return body; }; const sites = { ava: fetch('https://avajs.dev'), todomvc: fetch('https://todomvc.com'), github: fetch('https://github.com'), foo: 'bar' }; console.log(await pProps(sites)); // { // ava: ', >( input: InputType, mapper?: undefined, options?: Options ): Promise<{[key in keyof InputType]: Awaited}>; export default function pProps< InputType extends Record, ValueType extends InputType[keyof InputType], MappedValueType = Awaited, >( input: InputType, mapper?: Mapper, keyof InputType, MappedValueType>, options?: Options ): Promise<{[key in keyof InputType]: MappedValueType}>; export default function pProps< KeyType, ValueType, MappedValueType = Awaited, >( input: ReadonlyMap, mapper?: Mapper, KeyType, MappedValueType>, options?: Options ): Promise>; /** Like [`Promise.allSettled()`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) but for `Map` and `Object`. @param input - Resolves entry values that are promises. Other values are passed through. @param mapper - Receives the current value and key as parameters. Expected to return a `Promise` or value. @param options - See the [`p-map` options](https://github.com/sindresorhus/p-map#options). @returns A promise that is fulfilled when all promises in `input` and ones returned from `mapper` are settled. The fulfilled value is the same as `input`, but with a settled version of each entry value, or the settled value returned from `mapper`, if defined. @example ``` import {pPropsAllSettled} from 'p-props'; import got from 'got'; const fetch = async url => { const {body} = await got(url); return body; }; const sites = { ava: fetch('https://avajs.dev'), todomvc: fetch('https://todomvc.com'), github: fetch('https://github.com'), foo: 'bar' }; console.log(await pPropsAllSettled(sites)); // { // ava: { status: 'fulfilled', value: ', >( input: InputType, mapper?: undefined, options?: Options ): Promise<{[key in keyof InputType]: PromiseSettledResult>}>; export function pPropsAllSettled< InputType extends Record, ValueType extends InputType[keyof InputType], MappedValueType = Awaited, >( input: InputType, mapper?: Mapper, keyof InputType, MappedValueType>, options?: Options ): Promise<{[key in keyof InputType]: PromiseSettledResult}>; export function pPropsAllSettled< KeyType, ValueType, MappedValueType = Awaited, >( input: ReadonlyMap, mapper?: Mapper, KeyType, MappedValueType>, options?: Options ): Promise>>; export {Options} from 'p-map';