UNPKG

easy-api.ts

Version:

A powerful library to create your own API with ease.

47 lines (46 loc) 1.3 kB
/** * Represents an string token. */ export interface StringToken { value: string; } /** * Represents a function token. */ export interface FunctionToken { name: string; inside: string; fields: string[]; all: string; } /** * Represents first-phase-compilation token. */ export interface TemporalToken { value: string; type: string; } export declare class Compiler { /** * Convert all first-phase-compilation tokens to function and string tokens. * @param code - Code to be compiled. * @param dots - Whether enable "rs" syntax. * @param trim - Whether trim all code lines. * @returns {TemporalToken[]} */ pack(code: string, dots?: boolean, trim?: boolean): TemporalToken[]; /** * Converts a string token content to a function token. * @param input - Input to be converted. * @returns {FunctionToken} */ restructToken(input: string): FunctionToken; /** * Compiles source code into manipulable tokens. * @param code - Code to be compiled. * @param dots - Whether use "rs" syntax. * @param trim - Whether trim all code lines. * @returns {Array<TemporalToken | FunctionToken>} */ remap(code: string, dots?: boolean, trim?: boolean): (FunctionToken | TemporalToken)[]; }