UNPKG

args-any

Version:

Utility lib for parsing command options

36 lines (35 loc) 1.15 kB
import { ArgContainer, OpenRecord, Option, ParserSettings, ReadonlyMap } from "../../types"; /** * Map of `Option` */ export declare class OptionMap extends ReadonlyMap<string, Option> { private arg; private settings?; readonly args: ArgContainer; private mapArgs; constructor(arg: string[], settings?: Partial<ParserSettings> | undefined); /** * Filter a list of items based on options defined in the map * @param items The items to filter * @returns The items matching options in the map */ filter<T extends OpenRecord>(...items: T[]): T[]; /** * Check if an option exists in the map * @param key key of the option to check * @returns `true` if the option exists, otherwise `false` */ has(key: string): boolean; /** * Creates a `Partial<T>` from the `OptionMap` with the keys and values defined in the map */ asPartial<T>(): Partial<T>; /** * Get option by key * @param key The option to fetch * @returns `Option` for the specified `key` */ get(key: string): Option | undefined; /** @ignore */ private matches; }