@optique/core 1.0.0-dev.1424 → 1.0.0-dev.1436

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.
@@ -1620,6 +1620,7 @@ function email(options) {
1620
1620
  *
1621
1621
  * @param options - Options for socket address validation.
1622
1622
  * @returns A value parser for socket addresses.
1623
+ * @throws {TypeError} If `separator` is an empty string.
1623
1624
  * @throws {TypeError} If `separator` contains digit characters, since digits
1624
1625
  * in the separator would cause ambiguous splitting of port input.
1625
1626
  * @since 0.10.0
@@ -1643,6 +1644,7 @@ function email(options) {
1643
1644
  */
1644
1645
  function socketAddress(options) {
1645
1646
  const separator = options?.separator ?? ":";
1647
+ if (separator === "") throw new TypeError("Expected separator to not be empty.");
1646
1648
  if (/\p{Nd}/u.test(separator)) throw new TypeError(`Expected separator to not contain digits, but got: ${JSON.stringify(separator)}.`);
1647
1649
  const metavar = options?.metavar ?? `HOST${separator}PORT`;
1648
1650
  require_nonempty.ensureNonEmptyString(metavar);
@@ -1751,6 +1753,7 @@ function portRange(options) {
1751
1753
  checkBooleanOption(options, "allowSingle");
1752
1754
  if (options?.type !== void 0 && options.type !== "number" && options.type !== "bigint") throw new TypeError(`Expected type to be "number" or "bigint", but got: ${String(options.type)}.`);
1753
1755
  const separator = options?.separator ?? "-";
1756
+ if (separator === "") throw new TypeError("Expected separator to not be empty.");
1754
1757
  if (/\p{Nd}/u.test(separator)) throw new TypeError(`Expected separator to not contain digits, but got: ${JSON.stringify(separator)}.`);
1755
1758
  const metavar = options?.metavar ?? `PORT${separator}PORT`;
1756
1759
  require_nonempty.ensureNonEmptyString(metavar);
@@ -1205,6 +1205,7 @@ interface SocketAddressOptions {
1205
1205
  *
1206
1206
  * @param options - Options for socket address validation.
1207
1207
  * @returns A value parser for socket addresses.
1208
+ * @throws {TypeError} If `separator` is an empty string.
1208
1209
  * @throws {TypeError} If `separator` contains digit characters, since digits
1209
1210
  * in the separator would cause ambiguous splitting of port input.
1210
1211
  * @since 0.10.0
@@ -1432,6 +1433,7 @@ interface PortRangeOptionsBigInt {
1432
1433
  * @returns A value parser for port ranges.
1433
1434
  * @throws {TypeError} If `options.type` is provided but is neither `"number"`
1434
1435
  * nor `"bigint"`.
1436
+ * @throws {TypeError} If `separator` is an empty string.
1435
1437
  * @throws {TypeError} If `separator` contains digit characters, since digits
1436
1438
  * in the separator would cause ambiguous splitting of numeric port input.
1437
1439
  * @since 0.10.0
@@ -1205,6 +1205,7 @@ interface SocketAddressOptions {
1205
1205
  *
1206
1206
  * @param options - Options for socket address validation.
1207
1207
  * @returns A value parser for socket addresses.
1208
+ * @throws {TypeError} If `separator` is an empty string.
1208
1209
  * @throws {TypeError} If `separator` contains digit characters, since digits
1209
1210
  * in the separator would cause ambiguous splitting of port input.
1210
1211
  * @since 0.10.0
@@ -1432,6 +1433,7 @@ interface PortRangeOptionsBigInt {
1432
1433
  * @returns A value parser for port ranges.
1433
1434
  * @throws {TypeError} If `options.type` is provided but is neither `"number"`
1434
1435
  * nor `"bigint"`.
1436
+ * @throws {TypeError} If `separator` is an empty string.
1435
1437
  * @throws {TypeError} If `separator` contains digit characters, since digits
1436
1438
  * in the separator would cause ambiguous splitting of numeric port input.
1437
1439
  * @since 0.10.0
@@ -1620,6 +1620,7 @@ function email(options) {
1620
1620
  *
1621
1621
  * @param options - Options for socket address validation.
1622
1622
  * @returns A value parser for socket addresses.
1623
+ * @throws {TypeError} If `separator` is an empty string.
1623
1624
  * @throws {TypeError} If `separator` contains digit characters, since digits
1624
1625
  * in the separator would cause ambiguous splitting of port input.
1625
1626
  * @since 0.10.0
@@ -1643,6 +1644,7 @@ function email(options) {
1643
1644
  */
1644
1645
  function socketAddress(options) {
1645
1646
  const separator = options?.separator ?? ":";
1647
+ if (separator === "") throw new TypeError("Expected separator to not be empty.");
1646
1648
  if (/\p{Nd}/u.test(separator)) throw new TypeError(`Expected separator to not contain digits, but got: ${JSON.stringify(separator)}.`);
1647
1649
  const metavar = options?.metavar ?? `HOST${separator}PORT`;
1648
1650
  ensureNonEmptyString(metavar);
@@ -1751,6 +1753,7 @@ function portRange(options) {
1751
1753
  checkBooleanOption(options, "allowSingle");
1752
1754
  if (options?.type !== void 0 && options.type !== "number" && options.type !== "bigint") throw new TypeError(`Expected type to be "number" or "bigint", but got: ${String(options.type)}.`);
1753
1755
  const separator = options?.separator ?? "-";
1756
+ if (separator === "") throw new TypeError("Expected separator to not be empty.");
1754
1757
  if (/\p{Nd}/u.test(separator)) throw new TypeError(`Expected separator to not contain digits, but got: ${JSON.stringify(separator)}.`);
1755
1758
  const metavar = options?.metavar ?? `PORT${separator}PORT`;
1756
1759
  ensureNonEmptyString(metavar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.0.0-dev.1424+71e81eec",
3
+ "version": "1.0.0-dev.1436+4ad8f445",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",