-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
48 lines (48 loc) · 2.72 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
declare module "usefuljs" {
export function removeA<T>(arr: T[]):T[];
export function escape_dq(str:string):string;
export function escape_HTML(html_str:string):string;
export function diffObjs<T,R = T>(v1:T,v2:R): Partial<T | R>[];
export function arr_last<T>(arr: T[]): T;
export function prepend<T>(value:T,array:T[]):T[];
export function formatBytes(a:number,b:number): string;
export function array_push<T>(arr:T[], el:T): void;
export function array_remove<T>(array:T[], element:T): T[];
export function arr_dedup<T>(array:T[]):T[];
export function replaceAll(str:string,find:string,replace:string):string;
export function getDistFromBottom(element:HTMLElement):void;
export function obj2arr<T,O>(obj:O): T[];
export function form_validate(value:string,type:string,min:number|null,max:number|null,length:number):boolean;
export function validateEmail(email:string):boolean;
export function isInt(value:number):boolean;
export function isNum(value:string):boolean;
export function time_in_minutes(time:string):number;
export function arr_chunk<T>(arr:T[],length:number):T[][];
export function asyncForEach<T>(arr:T[],callback:Function):void;
export function obj_sort<T = any>(name:string,length:boolean,reverse:boolean):T;
export function arr_rm<T>(arr:T[],element:T,mutate:boolean|null):T[]|void;
export function arr_rmi<T>(arr:T[],index:number,mutate:boolean|null):T[] | void;
export function uuidv4():string;
export function unique_id():string;
export function shortuid():string;
export function matching_array<T>(ar0:T[],ar1:T[]):T[];
export function obj_prop_rename<T,R>(obj:T,oldName:string,newName:string):R;
export function obj_filter<T>(obj:T,predicate:Function):Partial<T>;
export function obj_key_filter<T>(obj:T,predicate:Function):Partial<T>;
export function ucfirst(text:string):string;
export function arr2Obj<T,O>(arr:T[],keyname:string):O;
export function sleep(milliseconds:number):Promise<void>;
export function f_arr<T>(test_array:T[]):T[];
export function f_obj<T>(obj:T):Partial<T>;
export function colourgen():string;
export function intgen(low:number,high:number):number;
export function arrobj2objarr<T,O>(arrobj:T[]):O;
export function arrobj2obj<T,O>(arrobj:T[],column:string):O;
export function hexCode(y:string):string;
export function toCSV<T>(json:T[]):string;
export function ajax<T>(arg:object):Promise<T>;
export function crc32(arg:string):string;
export function substrI(input:string,delimiter:string,index:number):string;
export function PromiseFallback<T>(pms:(()=>Promise<T>)[],retry?:number):Promise<T>;
export function ndjson_parse<T>(jsonString:string):T[];
}