validation.ts ×4

Frontier kind: Code frontier

unlabeled · c_2c3f693a848f

426 tests · 2190 LOC · 18 files · introduces 0 tests · 24 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges24 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
398 ranges2190 lines · 18 files · Browse complete extent
All tests (intent)
426 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 24 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

lib/validation.ts 18 introduced LOC · 4 ranges

Open complete file

27 // arguments were provided, i.e., '_'.
28 self.nonOptionCount = function nonOptionCount(argv) {
29 > const demandedCommands = yargs.getDemandedCommands(); validation.ts
30 > // don't count currently executing commands
31 > const positionalCount =
32 > argv._.length + (argv['--'] ? argv['--'].length : 0);
33 > const _s =
34 > positionalCount - yargs.getInternalMethods().getContext().commands.length;
35 >
36 > if (
37 > demandedCommands._ &&
38 (_s < demandedCommands._.min || _s > demandedCommands._.max)
39 > ) { validation.ts
40 if (_s < demandedCommands._.min) {
41 if (demandedCommands._.minMsg !== undefined) {
102 // make sure all the required arguments are present.
103 self.requiredArguments = function requiredArguments(
104 > argv, validation.ts
105 > demandedOptions: Dictionary<string | undefined>
106 > ) {
107 > let missing: Dictionary<string | undefined> | null = null;
108 >
109 > for (const key of Object.keys(demandedOptions)) {
110 if (
111 !Object.prototype.hasOwnProperty.call(argv, key) ||
116 }
117 }
119 > if (missing) {
120 const customMsgs: string[] = [];
121 for (const key of Object.keys(missing)) {
lib/yargs-factory.ts 6 introduced LOC · 2 ranges

Open complete file

2250 const demandedOptions = {...this.getDemandedOptions()};
2251 return (argv: Arguments) => {
2252 > if (parseErrors) throw new YError(parseErrors.message); yargs-factory.ts
2253 > this.#validation.nonOptionCount(argv);
2254 > this.#validation.requiredArguments(argv, demandedOptions);
2255 > let failedStrictCommands = false;
2256 > if (this.#strictCommands) {
2257 failedStrictCommands = this.#validation.unknownCommands(argv);
2258 }
2259 > if (this.#strict && !failedStrictCommands) { yargs-factory.ts
2260 this.#validation.unknownArguments(
2261 argv,