UNPKG

@velis/dynamicforms

Version:

Data entry boilerplate components and a RESTful API consumer

22 lines 1.17 kB
/** * Indexed array acts like an array, but is actually an object. * Some array methods are supported, like .map and .forEach * Additionally, the object has members mapping array items by their name for faster access * * Motivation for this class is primarily the faster access of array items by their name. * The reason this does not extend Array is that Vue seems to redeclare every Array descendant as plain Array */ export interface ItemWithName { name: string; } export default class IndexedArray<IndexedItem extends ItemWithName> { items: IndexedItem[]; length: number; [key: string]: IndexedItem | any; constructor(columns: IndexedItem[]); push(item: IndexedItem): number; forEach(callback: (value: IndexedItem, index?: number, array?: IndexedItem[]) => void, thisArg?: IndexedArray<IndexedItem>): void; map(callback: (value: IndexedItem, index?: number, array?: IndexedItem[]) => any, thisArg?: IndexedArray<IndexedItem>): any[]; reduce(callback: (previousValue: any, currentValue: IndexedItem, currentIndex: number, array: IndexedItem[]) => any, initialValue?: any): any; } //# sourceMappingURL=indexed-array.d.ts.map