trc-sheet
Version:
trc sheet support
46 lines (45 loc) • 2.04 kB
TypeScript
import * as common from 'trc-httpshim/common';
export declare class ColumnNames {
static readonly RecId: string;
static readonly FirstName: string;
static readonly LastName: string;
static readonly Party: string;
static readonly Address: string;
static readonly City: string;
static readonly Zip: string;
static readonly Lat: string;
static readonly Long: string;
static readonly XVoted: string;
static readonly XTargetPri: string;
static readonly PrecinctName: string;
static readonly Cellphone: string;
static readonly HHID: string;
static readonly XUser: string;
static readonly XApp: string;
static readonly XLat: string;
static readonly XLong: string;
static readonly XLastModified: string;
static readonly XIPAddress: string;
}
export interface ISheetContents {
[colName: string]: string[];
}
export declare class SheetContentsIndex {
private _map;
private _source;
constructor(source: ISheetContents);
lookupRecId(recId: string): number;
set(recId: string, columnName: string, newValue: string): void;
getContents(): ISheetContents;
}
export declare class SheetContents {
static getSheetContentsIndex(source: ISheetContents): SheetContentsIndex;
static toCsv(data: ISheetContents): string;
static ForEach(source: ISheetContents, callback: (recId: string, columnName: string, newValue: string) => void): void;
static FromSingleCell(recId: string, columnName: string, newValue: string): ISheetContents;
static FromRow(recId: string, columnNames: string[], newValues: string[]): ISheetContents;
static KeepRows(source: ISheetContents, fpInclude: (idx: number) => boolean): ISheetContents;
static TakeN(sheet: ISheetContents, topN: number): ISheetContents;
static AddTimestamp(source: ISheetContents, gps?: common.IGeoPointProvider): ISheetContents;
static Append(source: ISheetContents, newColumns: string[], newValues: string[]): ISheetContents;
}