UNPKG

optix

Version:

Optix is a data manipulation library that provides optics-like capabilites with a simpler syntax. It features robust Typescript support with minimal type annotations and is smaller and faster than true optics libraries.

23 lines (22 loc) 1.09 kB
import { Unarray } from "./types/common"; declare type Predicate<T> = (item: T) => unknown; export declare const last: (arr: any[]) => number; export declare const all: (arr: any[]) => number[]; export declare const keys: (obj: { [key: string]: any; }) => string[]; export declare const find: <T extends any[]>(predicate: Predicate<Unarray<T>>) => (arr: T) => number; export declare const findByKey: <T extends { [key: string]: any; }>(predicate: Predicate<Extract<keyof T, string>>) => (obj: T) => string | undefined; export declare const findByVal: <T extends { [key: string]: any; }>(predicate: Predicate<T[keyof T]>) => (obj: T) => string | undefined; export declare const filter: <T extends any[]>(predicate: Predicate<Unarray<T>>) => (arr: T) => number[]; export declare const filterByKey: <T extends { [key: string]: any; }>(predicate: Predicate<Extract<keyof T, string>>) => (obj: T) => string[]; export declare const filterByVal: <T extends { [key: string]: any; }>(predicate: Predicate<T[keyof T]>) => (obj: T) => string[]; export {};