args-tokens 0.10.0 → 0.10.2

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/resolver.js +3 -3
  2. package/package.json +11 -11
package/lib/resolver.js CHANGED
@@ -8,7 +8,6 @@ import { hasLongOptionPrefix, isShortOption } from './parser.js';
8
8
  * @returns An object that contains the values of the arguments, positional arguments, and {@link AggregateError | validation errors}.
9
9
  */
10
10
  export function resolveArgs(options, tokens) {
11
- const values = {};
12
11
  const positionals = [];
13
12
  const longOptionTokens = [];
14
13
  const shortOptionTokens = [];
@@ -109,6 +108,7 @@ export function resolveArgs(options, tokens) {
109
108
  /**
110
109
  * resolve values
111
110
  */
111
+ const values = Object.create(null);
112
112
  const errors = [];
113
113
  for (const [option, schema] of Object.entries(options)) {
114
114
  if (schema.required) {
@@ -185,7 +185,7 @@ export function resolveArgs(options, tokens) {
185
185
  return { values, positionals, error: errors.length > 0 ? new AggregateError(errors) : undefined };
186
186
  }
187
187
  function createRequireError(option, schema) {
188
- return new Error(`Option '--${option}' ${schema.short ? `or '-${schema.short}'` : ''} is required`);
188
+ return new Error(`Option '--${option}' ${schema.short ? `or '-${schema.short}' ` : ''}is required`);
189
189
  }
190
190
  function validateRequire(token, option, schema) {
191
191
  if (schema.required && schema.type !== 'boolean' && !token.value) {
@@ -214,7 +214,7 @@ function isNumeric(str) {
214
214
  return str.trim() !== '' && !isNaN(str);
215
215
  }
216
216
  function createTypeError(option, schema) {
217
- return new TypeError(`Option '--${option}' ${schema.short ? `or '-${schema.short}'` : ''} should be '${schema.type}'`);
217
+ return new TypeError(`Option '--${option}' ${schema.short ? `or '-${schema.short}' ` : ''}should be '${schema.type}'`);
218
218
  }
219
219
  function resolveOptionValue(token, schema) {
220
220
  if (token.value) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "args-tokens",
3
3
  "description": "parseArgs tokens compatibility and more high-performance parser",
4
- "version": "0.10.0",
4
+ "version": "0.10.2",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
@@ -68,26 +68,26 @@
68
68
  "@eslint/markdown": "^6.2.2",
69
69
  "@kazupon/eslint-config": "^0.22.0",
70
70
  "@kazupon/prettier-config": "^0.1.1",
71
- "@types/node": "^22.13.5",
72
- "@vitest/eslint-plugin": "^1.1.31",
71
+ "@types/node": "^22.13.9",
72
+ "@vitest/eslint-plugin": "^1.1.36",
73
73
  "bumpp": "^10.0.3",
74
74
  "eslint": "^9.21.0",
75
- "eslint-config-prettier": "^10.0.1",
75
+ "eslint-config-prettier": "^10.0.2",
76
76
  "eslint-plugin-jsonc": "^2.19.1",
77
77
  "eslint-plugin-promise": "^7.2.1",
78
78
  "eslint-plugin-regexp": "^2.7.0",
79
79
  "eslint-plugin-unicorn": "^57.0.0",
80
80
  "eslint-plugin-yml": "^1.17.0",
81
81
  "gh-changelogen": "^0.2.8",
82
- "jsr": "^0.13.3",
83
- "knip": "^5.44.4",
82
+ "jsr": "^0.13.4",
83
+ "knip": "^5.45.0",
84
84
  "lint-staged": "^15.4.3",
85
85
  "mitata": "^1.0.34",
86
- "pkg-pr-new": "^0.0.39",
87
- "prettier": "^3.5.2",
88
- "typescript": "^5.7.3",
89
- "typescript-eslint": "^8.24.1",
90
- "vitest": "^3.0.6"
86
+ "pkg-pr-new": "^0.0.40",
87
+ "prettier": "^3.5.3",
88
+ "typescript": "^5.8.2",
89
+ "typescript-eslint": "^8.26.0",
90
+ "vitest": "^3.0.7"
91
91
  },
92
92
  "prettier": "@kazupon/prettier-config",
93
93
  "lint-staged": {