// Type definitions for chopin-methods // Project: chopin // Definitions by: assaf.barash (assafbarash2@gmail.com) export namespace _Object { type Strategy = (a: T, b: T, strategis: { [type: string]: Strategy }) => T; export function deepGet(obj: { [key: string]: any }, path: string, safe?: boolean): any; export function deepSet(obj: T, path: string, val: any, safe?: boolean): T; export function exportDir(path: string, parseKey?: (key: string) => string): { [key: string]: any }; export function filter(obj: { [key: string]: T }, cb: (key: string, value: T) => boolean): { [key: string]: T }; export function groupBy(keyCb: (item: T) => string, valueCb?: (item: T) => any): (result: T[], current: T) => { [key: string]: T[] }; export function mapKey(obj: T, cb: (key: string, idx: number, obj: T) => string): { [key: string]: any }; export function mapValues(obj: T, cb: (value: any, idx: number, key: string, obj: T) => any): { [key: string]: any }; export function merge(source: any, target: any, strategis?: { object: Strategy, string: Strategy, number: Strategy, array: Strategy, def: Strategy }): any; export function rebuild(options?: { mapKey?: (key: string, value: any) => string, mapValue?: (value: any, key: string) => any }): (acc, tupl: { 0: string, 1: any }) => T; } export namespace _Array { export function groupBy(array: T[], cb: (item: T) => string): { [key: string]: T[] }; } export namespace _Function { type Composable = (c: Composable, idx: number) => T; export function compose(...args: Composable[]): T; export function extract(key: string): (item: { [key]: any }) => any; export function mandatory(message: string): void; } export namespace _String { type StringMethod = (str: string) => string export const camelToPascal: StringMethod; export const camelToSnake: StringMethod; export const capitalize: StringMethod; export const pascalToCamel: StringMethod; export const pascalToSnake: StringMethod; export const snakeToCamel: StringMethod; export const snakeToPascal: StringMethod; }