@vexify-org/yaggs 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/parser.js +13 -0
  2. package/package.json +1 -1
package/lib/parser.js CHANGED
@@ -41,6 +41,7 @@ class ArgumentParser {
41
41
  hidden: config.hidden || false,
42
42
  conflicts: config.conflicts || [],
43
43
  implies: config.implies || {},
44
+ global: config.global !== undefined ? config.global : true,
44
45
  ...config
45
46
  };
46
47
 
@@ -413,6 +414,18 @@ class ArgumentParser {
413
414
  this._handleError(`Not a directory: ${fullPath}`);
414
415
  }
415
416
  result[name] = fullPath;
417
+ } else if (opt.type === 'date') {
418
+ const date = new Date(value);
419
+ if (isNaN(date.getTime())) {
420
+ this._handleError(`Invalid date for option '${name}'`);
421
+ }
422
+ result[name] = date;
423
+ } else if (opt.type === 'regex') {
424
+ try {
425
+ result[name] = new RegExp(value);
426
+ } catch {
427
+ this._handleError(`Invalid regex for option '${name}'`);
428
+ }
416
429
  } else if (opt.type === 'custom' && opt._customType) {
417
430
  result[name] = opt._customType(value);
418
431
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vexify-org/yaggs",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "A powerful CLI argument parser, better than yargs",
5
5
  "main": "index.js",
6
6
  "scripts": {