js-slang
Version:
Javascript-based implementations of Source, written in Typescript
23 lines (22 loc) • 1.14 kB
TypeScript
import { RuntimeSourceError } from '../errors/runtimeSourceError';
import { Chapter } from '../types';
export declare class PromiseTimeoutError extends RuntimeSourceError {
}
export declare const timeoutPromise: <T>(promise: Promise<T>, timeout: number) => Promise<T>;
/**
* Run the mapping function over the items, filtering out any items that
* that the mapping function returned `undefined` for
*/
export declare function mapAndFilter<T, U>(items: T[], mapper: (input: T) => U | undefined): U[];
/**
* Type safe `Object.keys`
*/
export declare function objectKeys<T extends string | number | symbol>(obj: Record<T, any>): T[];
/**
* Type safe `Object.values`
*/
export declare function objectValues<T>(obj: Record<any, T>): T[];
/**
* Given the chapter value, return the string name of that chapter
*/
export declare function getChapterName(chapter: Chapter): "SOURCE_1" | "SOURCE_2" | "SOURCE_3" | "SOURCE_4" | "FULL_JS" | "HTML" | "FULL_TS" | "PYTHON_1" | "PYTHON_2" | "PYTHON_3" | "PYTHON_4" | "FULL_PYTHON" | "SCHEME_1" | "SCHEME_2" | "SCHEME_3" | "SCHEME_4" | "FULL_SCHEME" | "FULL_C" | "FULL_JAVA" | "LIBRARY_PARSER";