fly-json-odm
Version:
An Object Document Mapper to handle JSON on the fly for NodeJS or Browser
58 lines (56 loc) • 2.79 kB
TypeScript
export = FlyJson;
declare class FlyJson {
constructor (mixins?: object);
_sortBy (field: string, reverse: boolean, primer: Function): Function;
_findDistinct (source: object|Array<string|object|number>, obj: boolean): boolean;
setMode (name: string): this;
set (data: Array<object>): this;
list (): Array<object>;
insert (obj: object): this;
insertMany (data: Array<object>): this;
update (key: string, value: any, obj: object): this;
updateMany (key: string, data: Array<object>): this;
modify (key: string, value: any, obj: object): this;
modifyMany (key: string, data: Array<object>): this;
delete (key: string, value: any): this;
deleteMany (key: string, data: Array<string|number|object>): this;
select (key: Array<string>): this;
where (...args: any): this;
begin (): this;
or (): this;
end (): this;
distinct (fieldName?: string): this;
clean (): this;
join (name: string, data: Array<object>): this;
merge (a: string, b: string): this;
on (a: string, b: string, nested?: boolean, caseSensitive?: boolean): this;
orderBy (name: string, desc?: boolean, primer: Function): this;
groupDetail (name: string, groupName?: string): this;
groupBy (name: string, sumField?: Array<string>): this;
skip (size: string|number): this;
take (size: string|number): this;
paginate (page: string|number, pageSize: string|number): this;
promisify (fn: Function): this;
exec (): Array<object>;
isString (value: any): boolean;
isInteger (value: any): boolean;
isBoolean (value: any): boolean;
isArray (value: any): boolean;
isObject(value: any): boolean;
isEmpty (value: any): boolean;
isEmptyArray (value: any): boolean;
isEmptyObject (value: any): boolean;
fastCheckArrayObject (value: any): boolean;
foreach (data: Array<string|number|object>, callback: Function): void;
blockingTest (ms: number): void;
safeStringify (value: object, space: any): string;
shallowClone (array: Array<string|number|object>): Array<string|number|object>;
deepClone (array: Array<string|number|object>): Array<string|number|object>;
jsonTransform (data: object, map: object): Array<object>;
getDescendantProperty (object: object, path: string, list?: Array<string|number|object>): Array<string|number|object>;
fuzzySearch (query: string|number, keys: Array<string>, caseSensitive?: boolean, sort?: boolean): this;
fuzzy (haystack:Array<string|number|object>, query?: string|number, keys: Array<string>, caseSensitive?: boolean, sort?: boolean): Array<string|number|object>;
_fuzzyIsMatch (item: string|number, query: string|number, caseSensitive: boolean): number;
_fuzzyNearestIndexesFor (item: string, query: string): Array<number>;
_fuzzyIndexesOfFirstLetter (item: string, query: string): Array<number>;
}