node-json-db
Version:
Database using JSON file as storage for Node.JS
48 lines (47 loc) • 1.42 kB
TypeScript
import { KeyValue } from './Utils';
export declare const arrayRegex: () => RegExp;
export declare class ArrayInfo {
readonly property: string;
readonly index: number;
readonly append: boolean;
readonly indicies: any[];
constructor(property: string, indicies: any[]);
/**
* Check if the property want to access an Array
* @param property
*/
static processArray(property?: string): ArrayInfo | null;
/**
* Get the index for the array
* @param data
* @param avoidProperty
*/
getIndex(data: KeyValue, avoidProperty?: boolean): number;
/**
* Get the Data
* @param data
*/
getData(data: KeyValue): any;
/**
* Set the data for the array
* @param data
* @param value
*/
setData(data: KeyValue, value: any): void;
/**
* Delete the index from the array
* @param data
*/
delete(data: KeyValue): void;
/**
* Check if the ArrayInfo is valid for the given data
* @param data
*/
isValid(data: KeyValue): boolean;
private getArrayDataAndIndexFromProperty;
isMultiDimensional(): boolean;
}
export declare function isInt(value: any): boolean;
export declare function validateArrayIndicies(arrayIndicies: string[]): void;
export declare function validateArrayIndex(index: string): void;
export declare function getArrayIndicies(arrayIndicies: string): string[];