UNPKG

nerdamer-ts

Version:

javascript light-weight symbolic math expression evaluator

46 lines (45 loc) 1.59 kB
import { Symbol } from '../Types/Symbol'; export declare class VariableDictionary { private vars; private constants; private readonly reserved; setVar(name: string, value: any): void; getVar(name: string): any; isVar(name: string): any; deleteVar(name: string): void; clearAllVars(): void; getAllVars(): Record<string, any>; setConstant(name: string, value: any): void; getConstant(name: string): any; isConstant(name: string): boolean; getAllConstants(): Record<string, any>; deleteConstant(name: string): void; /** * Is used for u-substitution. Gets a suitable u for substitution. If for * instance a is used in the symbol then it keeps going down the line until * one is found that's not in use. If all letters are taken then it * starts appending numbers. * IMPORTANT! It assumes that the substitution will be undone * beore the user gets to interact with the object again. * @param {Symbol} symbol */ getU(symbol: Symbol): string; /** * Clears the u variable so it's no longer reserved * @param {String} u */ clearU(u: string): void; /** * Checks to see if value is one of nerdamer's reserved names * @param {String} name * @return boolean */ isReserved(name: string): boolean; reserveName(name: string): void; /** * Reserves the names in an object so they cannot be used as function names * @param {Object} obj */ reserveNames(obj: object | string): void; getReserved(): (string | undefined)[]; }