@@ -29,57 +29,13 @@ import { REGEXPS, THROWS_ERRORS_MESSAGES } from '#constants';
2929import { formatKey , convertValue } from '#functions' ;
3030
3131// ━━ TYPE DEFINITIONS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
32- /**
33- * Regular expressions used to validate command-line arguments.
34- *
35- * @private
36- * @typedef {object } Regexps
37- * @property {RegExp } UNIXMODE - Regular expression for validating Unix-style command-line arguments.
38- * @property {RegExp } SIMPLE - Regular expression for validating simple key-value arguments.
39- */
40-
41- /**
42- * Error messages used in case of invalid command-line arguments.
43- *
44- * @private
45- * @typedef {object } Errors
46- * @property {string } NO_ARGS - Error message for when no arguments are provided.
47- * @property {string } NO_MATCH_SIMPLE - Error message for when one or more simple key-value arguments do not follow the expected format.
48- * @property {string } NO_MATCH_UNIXMODE - Error message for when one or more Unix-style command-line arguments do not follow the expected format.
49- */
50-
5132/**
5233 * An `Object` with keys and values corresponding to the provided arguments.
5334 *
5435 * @typedef {object } ArgvObject
5536 * @property {string|boolean } [key=value] - The key-value pairs in the provided arguments.
5637 */
5738
58- // ━━ CONSTANTS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
59- /**
60- * Regular expressions used to validate command-line arguments.
61- *
62- * @private
63- * @type {Regexps }
64- */
65- const REGEXPS = {
66- UNIXMODE : / ^ - [ a - z ] { 1 } | - [ a - z ] { 1 } = .* $ | - - [ a - z A - Z ] + | - - [ a - z A - Z ] + (?: - [ a - z A - Z ] + ) * = .* $ / ,
67- SIMPLE : / ^ [ a - z A - Z ] + (?: - [ a - z A - Z ] + ) * = .* $ / ,
68- } ;
69-
70- /**
71- * Error messages used in case of invalid command-line arguments.
72- *
73- * @private
74- * @type {Errors }
75- */
76- const THROWS_ERRORS_MESSAGES = {
77- INVALID_UNIXMODE_TYPE : 'The "unixmode" value must be a boolean type' ,
78- NO_ARGUMENTS : 'No arguments added' ,
79- NO_MATCH_SIMPLE : `Some argument(s) do not follow the 'key=value' format.` ,
80- NO_MATCH_UNIXMODE : `Some argument(s) do not follow the Unix-style command-line format.` ,
81- } ;
82-
8339// ━━ MODULE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
8440/**
8541 * The `argv2Object()` function, converts command-line arguments to a key-value
0 commit comments