@optique/core 1.0.0-dev.467 → 1.0.0-dev.468
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.
- package/dist/valueparser.cjs +11 -4
- package/dist/valueparser.js +11 -4
- package/package.json +2 -1
package/dist/valueparser.cjs
CHANGED
|
@@ -127,10 +127,17 @@ function string(options = {}) {
|
|
|
127
127
|
$mode: "sync",
|
|
128
128
|
metavar,
|
|
129
129
|
parse(input) {
|
|
130
|
-
if (options.pattern != null
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
if (options.pattern != null) {
|
|
131
|
+
const pattern = new RegExp(options.pattern.source, options.pattern.flags);
|
|
132
|
+
if (pattern.test(input)) return {
|
|
133
|
+
success: true,
|
|
134
|
+
value: input
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
success: false,
|
|
138
|
+
error: options.errors?.patternMismatch ? typeof options.errors.patternMismatch === "function" ? options.errors.patternMismatch(input, options.pattern) : options.errors.patternMismatch : require_message.message`Expected a string matching pattern ${require_message.text(options.pattern.source)}, but got ${input}.`
|
|
139
|
+
};
|
|
140
|
+
}
|
|
134
141
|
return {
|
|
135
142
|
success: true,
|
|
136
143
|
value: input
|
package/dist/valueparser.js
CHANGED
|
@@ -127,10 +127,17 @@ function string(options = {}) {
|
|
|
127
127
|
$mode: "sync",
|
|
128
128
|
metavar,
|
|
129
129
|
parse(input) {
|
|
130
|
-
if (options.pattern != null
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
if (options.pattern != null) {
|
|
131
|
+
const pattern = new RegExp(options.pattern.source, options.pattern.flags);
|
|
132
|
+
if (pattern.test(input)) return {
|
|
133
|
+
success: true,
|
|
134
|
+
value: input
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
success: false,
|
|
138
|
+
error: options.errors?.patternMismatch ? typeof options.errors.patternMismatch === "function" ? options.errors.patternMismatch(input, options.pattern) : options.errors.patternMismatch : message`Expected a string matching pattern ${text(options.pattern.source)}, but got ${input}.`
|
|
139
|
+
};
|
|
140
|
+
}
|
|
134
141
|
return {
|
|
135
142
|
success: true,
|
|
136
143
|
value: input
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/core",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.468+67cf4104",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -175,6 +175,7 @@
|
|
|
175
175
|
"sideEffects": false,
|
|
176
176
|
"devDependencies": {
|
|
177
177
|
"@types/node": "^20.19.9",
|
|
178
|
+
"fast-check": "^4.5.3",
|
|
178
179
|
"tsdown": "^0.13.0",
|
|
179
180
|
"typescript": "^5.8.3"
|
|
180
181
|
},
|