import { PlainObject } from "../models.mjs"; //#region src/array/select.d.ts /** * Get a filtered and mapped array of items * * @param array Array to search in * @param filterCallback Callback to get an item's value for matching * @param filterValue Value to match against * @param mapCallback Callback to map the matched items * @returns Filtered and mapped array of items * * @example * ```typescript * select( * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}], * item => item.id, * 2, * item => item.name, * ); // => ['Bob'] * ``` */ declare function select unknown, MapCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType, mapCallback: MapCallback): Array>; /** * Get a filtered and mapped array of items * * @param array Array to search in * @param filterCallback Callback to get an item's value for matching * @param filterValue Value to match against * @param mapKey Key to get an item's value for mapping * @returns Filtered and mapped array of items * * @example * ```typescript * select( * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}], * item => item.id, * 2, * 'name', * ); // => ['Bob'] * ``` */ declare function select unknown, MapKey extends keyof Item>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType, mapKey: MapKey): Array; /** * Get a filtered and mapped array of items * * @param array Array to search in * @param filterKey Key to get an item's value for matching * @param filterValue Value to match against * @param mapCallback Callback to map the matched items * @returns Filtered and mapped array of items * * @example * ```typescript * select( * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}], * 'id', * 2, * item => item.name, * ); // => ['Bob'] * ``` */ declare function select unknown>(array: Item[], filterKey: ItemKey, filterValue: Item[ItemKey], mapCallback: MapCallback): Array>; /** * Get a filtered and mapped array of items * * @param array Array to search in * @param filterKey Key to get an item's value for matching * @param filterValue Value to match against * @param mapKey Key to get an item's value for mapping * @returns Filtered and mapped array of items * * @example * ```typescript * select( * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}], * 'id', * 2, * 'name', * ); // => ['Bob'] * ``` */ declare function select(array: Item[], filterKey: ItemKey, filterValue: Item[ItemKey], mapKey: MapKey): Array; /** * Get a filtered and mapped array of items * * @param array Array to search in * @param filterCallback Filter callback to match items * @param mapCallback Callback to map the matched items * @returns Filtered and mapped array of items * * @example * ```typescript * select( * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}], * item => item.id === 2, * item => item.name, * ); // => ['Bob'] * ``` */ declare function select unknown, MapCallback extends (item: Item, index: number, array: Item[]) => unknown>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType, mapCallback: MapCallback): Array>; /** * Get a filtered and mapped array of items * * @param array Array to search in * @param filterCallback Filter callback to match items * @param mapKey Key to get an item's value for mapping * @returns Filtered and mapped array of items * * @example * ```typescript * select( * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}], * item => item.id, * 2, * 'name' * ); // => ['Bob'] * ``` */ declare function select unknown, MapKey extends keyof Item>(array: Item[], filterCallback: FilterCallback, filterValue: ReturnType, mapKey: MapKey): Array; /** * Get a filtered and mapped array of items * * @param array Array to search in * @param filter Filter callback to match items * @param map Callback to map the matched items * @returns Filtered and mapped array of items * * @example * ```typescript * select( * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}], * item => item.id === 2, * item => item.name, * ); // => ['Bob'] * ``` */ declare function select unknown>(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean, map: MapCallback): Array>; /** * Get a filtered and mapped array of items * * @param array Array to search in * @param filter Filter callback to match items * @param map Key to get an item's value for mapping * @returns Filtered and mapped array of items * * @example * ```typescript * select( * [{id: 1, name: 'Alice'}, {id: 2, name: 'Bob'}, {id: 3, name: 'Charlie'}], * item => item.id === 2, * 'name' * ); // => ['Bob'] * ``` */ declare function select(array: Item[], filter: (item: Item, index: number, array: Item[]) => boolean, map: MapKey): Array; /** * Get a filtered and mapped array of items * * @param array Array to search in * @param item Item to match against * @param map Callback to map the matched items * @returns Filtered and mapped array of items * * @example * ```typescript * select( * [1, 2, 3, 2, 1], * 3, * value => value ** 2, * ); // => [9] * ``` */ declare function select unknown>(array: Item[], item: Item, map: MapCallback): Array>; //#endregion export { select };