UNPKG

@adonisjs/sink

Version:

AdonisJS sink is a swiss knife for managing project files by applying minimal changes, inferring formatting from EditorConfig file and comes with specialized tasks for different file formats and file types.

44 lines (43 loc) 1.04 kB
import { json, yaml, ini } from 'mrm-core'; import { File } from './File'; /** * Exposes the API to work with key/value pair files like `ini`, `yaml` * and `json`. */ export declare abstract class KeyValuePair extends File { protected actions: never[]; /** * Only these key-value pair files are supported */ abstract filePointer: ReturnType<typeof json> | ReturnType<typeof yaml> | ReturnType<typeof ini>; constructor(basePath: string); /** * Set key/value pair */ set(key: string, value: any): this; /** * Unset key/value pair */ unset(key: string): this; /** * Remove file */ delete(): this; /** * Returns value for a given key from the file */ get(): any; get(address: string | string[], defaultValue?: any): any; /** * A boolean telling if the file already exists */ exists(): boolean; /** * Commit mutations */ commit(): void; /** * Rollback mutations */ rollback(): void; }