Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 8x 8x 29x 9x 9x 5x 4x 4x 9x 23x | /** * @internal * ArgMap exports a map of arguments passed to the application * @module ArgMap * @category Configuration */ /** * Class representing a map of command line arguments */ export class CommandLineArgumentsMap { /** * Map of arguments name and values */ private argumentsMap: Map<string, string>; /** * Creates an instance of CommandLineArgumentsMap. * @param {string[]} [commandLineArguments=process.argv] - Array of command line arguments */ constructor(commandLineArguments: string[] = process.argv) { this.argumentsMap = new Map<string, string>(); commandLineArguments.forEach((argument, index) => { if (argument.startsWith("--")) { let name: string; let value: string; argument = argument.slice(2); if (argument.includes("=")) { [name, value] = argument.split("=").slice(0, 2); } else { name = argument; value = commandLineArguments[index + 1] || ""; } this.argumentsMap.set(name, value); } }); } /** * Gets the value of the specified argument * @param {string} arg - argument name * @returns {(string | undefined)} - argument value or undefined */ get(arg: string): string | undefined { return this.argumentsMap.get(arg); } public forEach(callback: (value: string, key: string) => void): void { this.argumentsMap.forEach(callback); } } |