UNPKG

wael-lib

Version:

Well-Known Text Arithmetic Expression Language

81 lines (75 loc) 2.62 kB
interface ScopeBindings { [identifier: string]: any; } interface Metadata { public: boolean; } declare class Scope { private parent?; readonly level: number; readonly IDENTIFIER_SCOPE = "$SCOPE"; readonly IDENTIFIER_VERSION = "$VERSION"; bindings: ScopeBindings; availableBindings: ScopeBindings; private metadata; private closures; constructor(parent?: Scope | undefined, level?: number, defaultBindings?: ScopeBindings); store(identifier: string, value: any, metadata?: Metadata, searchParentChain?: boolean): void; resolveScope(identifier: string): Scope | undefined; resolve(identifier: string): any; push(extraBindings?: ScopeBindings): Scope; pop(additionalBindings?: ScopeBindings): Scope | undefined; import(scopeBindings: ScopeBindings): void; useImports(selectedIdentifiers?: string[]): ScopeBindings; useNamedImports(selectedIdentifiers: string[]): ScopeBindings; capture(capturedScope: Scope): void; release(): void; } declare enum OutputFormat { WKT = "WKT", GeoJSON = "GeoJSON" } interface Options { outputFormat?: OutputFormat; outputNonGeoJSON?: boolean; scope?: Scope; storeHistoricalEvaluations?: boolean; workingDirectory?: string; useStdLib?: boolean; } declare const DEFAULT_OPTIONS: Options; declare class Wael { private options; private evaluationCount; private history; static IDENTIFIER_LAST: string; static IDENTIFIER_OPTIONS: string; static IDENTIFIER_HISTORY: string; constructor(initialOptions?: Options); getEvaluationCount(): number; evaluate(input: string, overrideOptions?: Partial<Options>): any; private useStdLib; static evaluate(input: string, options?: Partial<Options>): any; private static getOutputString; } declare namespace Interpreter { const IMPORT_USING_ALL = "*"; const DEFAULT_EXPORT_BINDING = "export"; const STANDARD_LIBRARY: ScopeBindings; const createGlobalScope: () => Scope; function evaluateInput(input: string, initialScope?: Scope, workingDirectory?: string): any; } type GeoJSON = any; declare enum GeometryType { Point = "Point", LineString = "LineString", Polygon = "Polygon", MultiPoint = "MultiPoint", MultiLineString = "MultiLineString", MultiPolygon = "MultiPolygon", GeometryCollection = "GeometryCollection" } type Unit = null; declare const UNIT: Unit; declare const GRAMMAR: string; export { DEFAULT_OPTIONS, GRAMMAR, type GeoJSON, GeometryType, Interpreter, type Options, OutputFormat, Scope, type ScopeBindings, UNIT, type Unit, Wael };