@optique/core 1.0.0-dev.893 → 1.0.0-dev.896
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 +10 -20
- package/dist/valueparser.js +10 -20
- package/package.json +1 -1
package/dist/valueparser.cjs
CHANGED
|
@@ -317,16 +317,11 @@ function integer(options) {
|
|
|
317
317
|
$mode: "sync",
|
|
318
318
|
metavar: metavar$1,
|
|
319
319
|
parse(input) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
success: false,
|
|
326
|
-
error: options.errors?.invalidInteger ? typeof options.errors.invalidInteger === "function" ? options.errors.invalidInteger(input) : options.errors.invalidInteger : require_message.message`Expected a valid integer, but got ${input}.`
|
|
327
|
-
};
|
|
328
|
-
throw e;
|
|
329
|
-
}
|
|
320
|
+
if (!input.match(/^-?\d+$/)) return {
|
|
321
|
+
success: false,
|
|
322
|
+
error: options.errors?.invalidInteger ? typeof options.errors.invalidInteger === "function" ? options.errors.invalidInteger(input) : options.errors.invalidInteger : require_message.message`Expected a valid integer, but got ${input}.`
|
|
323
|
+
};
|
|
324
|
+
const value = BigInt(input);
|
|
330
325
|
if (options.min != null && value < options.min) return {
|
|
331
326
|
success: false,
|
|
332
327
|
error: options.errors?.belowMinimum ? typeof options.errors.belowMinimum === "function" ? options.errors.belowMinimum(value, options.min) : options.errors.belowMinimum : require_message.message`Expected a value greater than or equal to ${require_message.text(options.min.toLocaleString("en"))}, but got ${input}.`
|
|
@@ -854,16 +849,11 @@ function port(options) {
|
|
|
854
849
|
$mode: "sync",
|
|
855
850
|
metavar: metavar$1,
|
|
856
851
|
parse(input) {
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
success: false,
|
|
863
|
-
error: options.errors?.invalidPort ? typeof options.errors.invalidPort === "function" ? options.errors.invalidPort(input) : options.errors.invalidPort : require_message.message`Expected a valid port number, but got ${input}.`
|
|
864
|
-
};
|
|
865
|
-
throw e;
|
|
866
|
-
}
|
|
852
|
+
if (!input.match(/^-?\d+$/)) return {
|
|
853
|
+
success: false,
|
|
854
|
+
error: options.errors?.invalidPort ? typeof options.errors.invalidPort === "function" ? options.errors.invalidPort(input) : options.errors.invalidPort : require_message.message`Expected a valid port number, but got ${input}.`
|
|
855
|
+
};
|
|
856
|
+
const value = BigInt(input);
|
|
867
857
|
if (value < min$1) return {
|
|
868
858
|
success: false,
|
|
869
859
|
error: options.errors?.belowMinimum ? typeof options.errors.belowMinimum === "function" ? options.errors.belowMinimum(value, min$1) : options.errors.belowMinimum : require_message.message`Expected a port number greater than or equal to ${require_message.text(min$1.toLocaleString("en"))}, but got ${input}.`
|
package/dist/valueparser.js
CHANGED
|
@@ -317,16 +317,11 @@ function integer(options) {
|
|
|
317
317
|
$mode: "sync",
|
|
318
318
|
metavar: metavar$1,
|
|
319
319
|
parse(input) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
success: false,
|
|
326
|
-
error: options.errors?.invalidInteger ? typeof options.errors.invalidInteger === "function" ? options.errors.invalidInteger(input) : options.errors.invalidInteger : message`Expected a valid integer, but got ${input}.`
|
|
327
|
-
};
|
|
328
|
-
throw e;
|
|
329
|
-
}
|
|
320
|
+
if (!input.match(/^-?\d+$/)) return {
|
|
321
|
+
success: false,
|
|
322
|
+
error: options.errors?.invalidInteger ? typeof options.errors.invalidInteger === "function" ? options.errors.invalidInteger(input) : options.errors.invalidInteger : message`Expected a valid integer, but got ${input}.`
|
|
323
|
+
};
|
|
324
|
+
const value = BigInt(input);
|
|
330
325
|
if (options.min != null && value < options.min) return {
|
|
331
326
|
success: false,
|
|
332
327
|
error: options.errors?.belowMinimum ? typeof options.errors.belowMinimum === "function" ? options.errors.belowMinimum(value, options.min) : options.errors.belowMinimum : message`Expected a value greater than or equal to ${text(options.min.toLocaleString("en"))}, but got ${input}.`
|
|
@@ -854,16 +849,11 @@ function port(options) {
|
|
|
854
849
|
$mode: "sync",
|
|
855
850
|
metavar: metavar$1,
|
|
856
851
|
parse(input) {
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
}
|
|
861
|
-
|
|
862
|
-
success: false,
|
|
863
|
-
error: options.errors?.invalidPort ? typeof options.errors.invalidPort === "function" ? options.errors.invalidPort(input) : options.errors.invalidPort : message`Expected a valid port number, but got ${input}.`
|
|
864
|
-
};
|
|
865
|
-
throw e;
|
|
866
|
-
}
|
|
852
|
+
if (!input.match(/^-?\d+$/)) return {
|
|
853
|
+
success: false,
|
|
854
|
+
error: options.errors?.invalidPort ? typeof options.errors.invalidPort === "function" ? options.errors.invalidPort(input) : options.errors.invalidPort : message`Expected a valid port number, but got ${input}.`
|
|
855
|
+
};
|
|
856
|
+
const value = BigInt(input);
|
|
867
857
|
if (value < min$1) return {
|
|
868
858
|
success: false,
|
|
869
859
|
error: options.errors?.belowMinimum ? typeof options.errors.belowMinimum === "function" ? options.errors.belowMinimum(value, min$1) : options.errors.belowMinimum : message`Expected a port number greater than or equal to ${text(min$1.toLocaleString("en"))}, but got ${input}.`
|