r3bl-ts-utils
Version:
The `r3bl-ts-utils` package is a set of useful TypeScript functions and classes that can be used in Node.js and browser environments. They are inspired by Kotlin stdlib, and Rust to write code as expressions rather than statements, colorized text, powerfu
25 lines (24 loc) • 1.02 kB
TypeScript
import { Keypress } from "./keypress";
/**
* Note that the value of the map entry is a function that returns a copy of a key, so that there is
* no chance of creating mutable constants that are shared publicly. The object that is returned is
* meant to be modified (it is mutable) by other parts of the code.
*/
declare type InputToKeyPressDictionary = Map<string, () => Keypress>;
export declare const keyCodeMap: InputToKeyPressDictionary;
export declare const keyNameMap: InputToKeyPressDictionary;
export declare const keySequenceMap: InputToKeyPressDictionary;
/**
* This describes a keypress event that comes in from Node.js readline. The sequence, name, and code
* properties are optional. Run the `npm run exp-node-readline-keypress-logger` script (which runs
* readline-keypress-logger.ts in experimental) in order to see this in action.
*/
export interface ReadlineKey {
sequence?: string;
name?: string;
code?: string;
ctrl: boolean;
meta: boolean;
shift: boolean;
}
export {};