/** * High-level compile API for Elo * * Compiles Elo expressions to callable JavaScript functions with * runtime dependency injection. */ /** * Runtime dependencies that can be injected into compiled functions. * All dependencies used by the JS compiler should be listed here. */ export interface EloRuntime { DateTime?: unknown; Duration?: unknown; } /** * Options for the compile function */ export interface CompileOptions { runtime?: EloRuntime; } /** * Compiles an Elo expression to a callable JavaScript function. * * Every Elo expression compiles to a function that takes `_` (the implicit input) as parameter. * You call the returned function with your input value. * * @example * ```typescript * import { compile } from '@contextvm/elo'; * import { DateTime, Duration } from 'luxon'; * * // Simple expression using _ (implicit input) * const addTen = compile<(x: number) => number>( * '_ + 10', * { runtime: { DateTime, Duration } } * ); * addTen(5); // => 15 * * // Temporal expression * const inThisWeek = compile<(d: unknown) => boolean>( * '_ in SOW ... EOW', * { runtime: { DateTime, Duration } } * ); * inThisWeek(DateTime.now()); // => true or false * ``` */ export declare function compile(source: string, options?: CompileOptions): T; //# sourceMappingURL=compile.d.ts.map