@optique/core 1.0.0-dev.1484 → 1.0.0-dev.1492
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 +148 -39
- package/dist/valueparser.js +148 -39
- package/package.json +1 -1
package/dist/valueparser.cjs
CHANGED
|
@@ -1726,73 +1726,182 @@ function socketAddress(options) {
|
|
|
1726
1726
|
metavar,
|
|
1727
1727
|
parse(input) {
|
|
1728
1728
|
const trimmed = input.trim();
|
|
1729
|
-
const
|
|
1730
|
-
let
|
|
1731
|
-
let
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
const
|
|
1742
|
-
if (
|
|
1743
|
-
|
|
1729
|
+
const canOmitPort = defaultPort !== void 0 && !requirePort;
|
|
1730
|
+
let firstHostError;
|
|
1731
|
+
let validHostNumericPortInvalid = false;
|
|
1732
|
+
let trailingSepHost;
|
|
1733
|
+
let trailingSepHostError;
|
|
1734
|
+
let anySeparatorFound = false;
|
|
1735
|
+
let searchFrom = trimmed.length;
|
|
1736
|
+
while (searchFrom > 0) {
|
|
1737
|
+
const separatorIndex = trimmed.lastIndexOf(separator, searchFrom - 1);
|
|
1738
|
+
if (separatorIndex === -1) break;
|
|
1739
|
+
anySeparatorFound = true;
|
|
1740
|
+
const hostPart = trimmed.substring(0, separatorIndex);
|
|
1741
|
+
const portPart = trimmed.substring(separatorIndex + separator.length);
|
|
1742
|
+
if (portPart === "") {
|
|
1743
|
+
if (trailingSepHost === void 0 && trailingSepHostError === void 0) {
|
|
1744
|
+
const hostResult = parseHost(hostPart);
|
|
1745
|
+
if (hostResult.success) trailingSepHost = hostResult.value;
|
|
1746
|
+
else trailingSepHostError = {
|
|
1747
|
+
hostPart,
|
|
1748
|
+
error: hostResult.error
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
} else {
|
|
1752
|
+
const portResult = portParser.parse(portPart);
|
|
1753
|
+
if (portResult.success) {
|
|
1754
|
+
const hostResult = parseHost(hostPart);
|
|
1755
|
+
if (hostResult.success) return {
|
|
1756
|
+
success: true,
|
|
1757
|
+
value: {
|
|
1758
|
+
host: hostResult.value,
|
|
1759
|
+
port: portResult.value
|
|
1760
|
+
}
|
|
1761
|
+
};
|
|
1762
|
+
if (firstHostError === void 0 || (looksLikeIpv4(hostPart) || looksLikeAltIpv4Literal(hostPart)) && !looksLikeIpv4(firstHostError.hostPart) && !looksLikeAltIpv4Literal(firstHostError.hostPart)) firstHostError = {
|
|
1763
|
+
hostPart,
|
|
1764
|
+
error: hostResult.error
|
|
1765
|
+
};
|
|
1766
|
+
} else if (!validHostNumericPortInvalid && hostPart !== "" && /^[0-9]+$/.test(portPart)) if (looksLikeIpv4(hostPart) || looksLikeAltIpv4Literal(hostPart)) {
|
|
1767
|
+
const hostResult = parseHost(hostPart);
|
|
1768
|
+
if (!hostResult.success) {
|
|
1769
|
+
if (firstHostError === void 0 || !looksLikeIpv4(firstHostError.hostPart) && !looksLikeAltIpv4Literal(firstHostError.hostPart)) firstHostError = {
|
|
1770
|
+
hostPart,
|
|
1771
|
+
error: hostResult.error
|
|
1772
|
+
};
|
|
1773
|
+
} else validHostNumericPortInvalid = true;
|
|
1774
|
+
} else validHostNumericPortInvalid = true;
|
|
1775
|
+
else if ((firstHostError === void 0 || !looksLikeIpv4(firstHostError.hostPart) && !looksLikeAltIpv4Literal(firstHostError.hostPart)) && (looksLikeIpv4(hostPart) || looksLikeAltIpv4Literal(hostPart))) {
|
|
1776
|
+
const hostResult = parseHost(hostPart);
|
|
1777
|
+
if (!hostResult.success) firstHostError = {
|
|
1778
|
+
hostPart,
|
|
1779
|
+
error: hostResult.error
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
searchFrom = separatorIndex;
|
|
1784
|
+
}
|
|
1785
|
+
if (validHostNumericPortInvalid) {
|
|
1786
|
+
const errorMsg$1 = options?.errors?.invalidFormat;
|
|
1787
|
+
if (errorMsg$1) {
|
|
1788
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1;
|
|
1744
1789
|
return {
|
|
1745
1790
|
success: false,
|
|
1746
1791
|
error: msg
|
|
1747
1792
|
};
|
|
1748
1793
|
}
|
|
1749
|
-
|
|
1794
|
+
return {
|
|
1750
1795
|
success: false,
|
|
1751
|
-
error:
|
|
1796
|
+
error: require_message.message`Expected a socket address in format host${separator}port, but got ${input}.`
|
|
1797
|
+
};
|
|
1798
|
+
}
|
|
1799
|
+
if (firstHostError !== void 0) {
|
|
1800
|
+
if (looksLikeIpv4(firstHostError.hostPart) || looksLikeAltIpv4Literal(firstHostError.hostPart)) {
|
|
1801
|
+
const errorMsg$1 = options?.errors?.invalidFormat;
|
|
1802
|
+
if (errorMsg$1) {
|
|
1803
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1;
|
|
1804
|
+
return {
|
|
1805
|
+
success: false,
|
|
1806
|
+
error: msg
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
return {
|
|
1810
|
+
success: false,
|
|
1811
|
+
error: firstHostError.error
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
let hostOnlyResult;
|
|
1816
|
+
if (!requirePort || trailingSepHost !== void 0 || trailingSepHostError !== void 0) {
|
|
1817
|
+
hostOnlyResult = parseHost(trimmed);
|
|
1818
|
+
if (canOmitPort && hostOnlyResult.success) return {
|
|
1819
|
+
success: true,
|
|
1820
|
+
value: {
|
|
1821
|
+
host: hostOnlyResult.value,
|
|
1822
|
+
port: defaultPort
|
|
1823
|
+
}
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
if (trailingSepHost !== void 0 && hostOnlyResult !== void 0 && !hostOnlyResult.success) {
|
|
1827
|
+
if (canOmitPort) return {
|
|
1828
|
+
success: true,
|
|
1829
|
+
value: {
|
|
1830
|
+
host: trailingSepHost,
|
|
1831
|
+
port: defaultPort
|
|
1832
|
+
}
|
|
1752
1833
|
};
|
|
1834
|
+
const errorMsg$1 = options?.errors?.missingPort;
|
|
1835
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1 ?? require_message.message`Port number is required but was not specified.`;
|
|
1753
1836
|
return {
|
|
1754
1837
|
success: false,
|
|
1755
|
-
error:
|
|
1838
|
+
error: msg
|
|
1756
1839
|
};
|
|
1757
1840
|
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
const errorMsg = options?.errors?.missingPort;
|
|
1763
|
-
const msg = typeof errorMsg === "function" ? errorMsg(input) : errorMsg ?? require_message.message`Port number is required but was not specified.`;
|
|
1841
|
+
if (trailingSepHostError !== void 0 && hostOnlyResult !== void 0 && !hostOnlyResult.success) {
|
|
1842
|
+
const errorMsg$1 = options?.errors?.invalidFormat;
|
|
1843
|
+
if (errorMsg$1) {
|
|
1844
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1;
|
|
1764
1845
|
return {
|
|
1765
1846
|
success: false,
|
|
1766
1847
|
error: msg
|
|
1767
1848
|
};
|
|
1768
1849
|
}
|
|
1769
|
-
if (
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1850
|
+
if (looksLikeIpv4(trailingSepHostError.hostPart) || looksLikeAltIpv4Literal(trailingSepHostError.hostPart)) return {
|
|
1851
|
+
success: false,
|
|
1852
|
+
error: trailingSepHostError.error
|
|
1853
|
+
};
|
|
1854
|
+
return {
|
|
1855
|
+
success: false,
|
|
1856
|
+
error: require_message.message`Expected a socket address in format host${separator}port, but got ${input}.`
|
|
1857
|
+
};
|
|
1858
|
+
}
|
|
1859
|
+
if (!canOmitPort && !requirePort && hostOnlyResult !== void 0 && hostOnlyResult.success) {
|
|
1860
|
+
const errorMsg$1 = options?.errors?.missingPort;
|
|
1861
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1 ?? require_message.message`Port number is required but was not specified.`;
|
|
1862
|
+
return {
|
|
1863
|
+
success: false,
|
|
1864
|
+
error: msg
|
|
1865
|
+
};
|
|
1866
|
+
}
|
|
1867
|
+
if (!canOmitPort && !anySeparatorFound) {
|
|
1868
|
+
hostOnlyResult = hostOnlyResult ?? parseHost(trimmed);
|
|
1869
|
+
if (hostOnlyResult.success) {
|
|
1870
|
+
const errorMsg$1 = options?.errors?.missingPort;
|
|
1871
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1 ?? require_message.message`Port number is required but was not specified.`;
|
|
1773
1872
|
return {
|
|
1774
1873
|
success: false,
|
|
1775
1874
|
error: msg
|
|
1776
1875
|
};
|
|
1777
1876
|
}
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
const msg = typeof errorMsg === "function" ? errorMsg(input) : errorMsg
|
|
1877
|
+
}
|
|
1878
|
+
if (firstHostError !== void 0) {
|
|
1879
|
+
const errorMsg$1 = options?.errors?.invalidFormat;
|
|
1880
|
+
if (errorMsg$1) {
|
|
1881
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1;
|
|
1783
1882
|
return {
|
|
1784
1883
|
success: false,
|
|
1785
1884
|
error: msg
|
|
1786
1885
|
};
|
|
1787
1886
|
}
|
|
1788
|
-
|
|
1887
|
+
}
|
|
1888
|
+
const errorMsg = options?.errors?.invalidFormat;
|
|
1889
|
+
if (errorMsg) {
|
|
1890
|
+
const msg = typeof errorMsg === "function" ? errorMsg(input) : errorMsg;
|
|
1891
|
+
return {
|
|
1892
|
+
success: false,
|
|
1893
|
+
error: msg
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
if (hostOnlyResult !== void 0 && !hostOnlyResult.success) {
|
|
1897
|
+
if (looksLikeIpv4(trimmed) || looksLikeAltIpv4Literal(trimmed)) return {
|
|
1898
|
+
success: false,
|
|
1899
|
+
error: hostOnlyResult.error
|
|
1900
|
+
};
|
|
1789
1901
|
}
|
|
1790
1902
|
return {
|
|
1791
|
-
success:
|
|
1792
|
-
|
|
1793
|
-
host: validatedHost,
|
|
1794
|
-
port: validatedPort
|
|
1795
|
-
}
|
|
1903
|
+
success: false,
|
|
1904
|
+
error: require_message.message`Expected a socket address in format host${separator}port, but got ${input}.`
|
|
1796
1905
|
};
|
|
1797
1906
|
},
|
|
1798
1907
|
format(value) {
|
package/dist/valueparser.js
CHANGED
|
@@ -1726,73 +1726,182 @@ function socketAddress(options) {
|
|
|
1726
1726
|
metavar,
|
|
1727
1727
|
parse(input) {
|
|
1728
1728
|
const trimmed = input.trim();
|
|
1729
|
-
const
|
|
1730
|
-
let
|
|
1731
|
-
let
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
const
|
|
1742
|
-
if (
|
|
1743
|
-
|
|
1729
|
+
const canOmitPort = defaultPort !== void 0 && !requirePort;
|
|
1730
|
+
let firstHostError;
|
|
1731
|
+
let validHostNumericPortInvalid = false;
|
|
1732
|
+
let trailingSepHost;
|
|
1733
|
+
let trailingSepHostError;
|
|
1734
|
+
let anySeparatorFound = false;
|
|
1735
|
+
let searchFrom = trimmed.length;
|
|
1736
|
+
while (searchFrom > 0) {
|
|
1737
|
+
const separatorIndex = trimmed.lastIndexOf(separator, searchFrom - 1);
|
|
1738
|
+
if (separatorIndex === -1) break;
|
|
1739
|
+
anySeparatorFound = true;
|
|
1740
|
+
const hostPart = trimmed.substring(0, separatorIndex);
|
|
1741
|
+
const portPart = trimmed.substring(separatorIndex + separator.length);
|
|
1742
|
+
if (portPart === "") {
|
|
1743
|
+
if (trailingSepHost === void 0 && trailingSepHostError === void 0) {
|
|
1744
|
+
const hostResult = parseHost(hostPart);
|
|
1745
|
+
if (hostResult.success) trailingSepHost = hostResult.value;
|
|
1746
|
+
else trailingSepHostError = {
|
|
1747
|
+
hostPart,
|
|
1748
|
+
error: hostResult.error
|
|
1749
|
+
};
|
|
1750
|
+
}
|
|
1751
|
+
} else {
|
|
1752
|
+
const portResult = portParser.parse(portPart);
|
|
1753
|
+
if (portResult.success) {
|
|
1754
|
+
const hostResult = parseHost(hostPart);
|
|
1755
|
+
if (hostResult.success) return {
|
|
1756
|
+
success: true,
|
|
1757
|
+
value: {
|
|
1758
|
+
host: hostResult.value,
|
|
1759
|
+
port: portResult.value
|
|
1760
|
+
}
|
|
1761
|
+
};
|
|
1762
|
+
if (firstHostError === void 0 || (looksLikeIpv4(hostPart) || looksLikeAltIpv4Literal(hostPart)) && !looksLikeIpv4(firstHostError.hostPart) && !looksLikeAltIpv4Literal(firstHostError.hostPart)) firstHostError = {
|
|
1763
|
+
hostPart,
|
|
1764
|
+
error: hostResult.error
|
|
1765
|
+
};
|
|
1766
|
+
} else if (!validHostNumericPortInvalid && hostPart !== "" && /^[0-9]+$/.test(portPart)) if (looksLikeIpv4(hostPart) || looksLikeAltIpv4Literal(hostPart)) {
|
|
1767
|
+
const hostResult = parseHost(hostPart);
|
|
1768
|
+
if (!hostResult.success) {
|
|
1769
|
+
if (firstHostError === void 0 || !looksLikeIpv4(firstHostError.hostPart) && !looksLikeAltIpv4Literal(firstHostError.hostPart)) firstHostError = {
|
|
1770
|
+
hostPart,
|
|
1771
|
+
error: hostResult.error
|
|
1772
|
+
};
|
|
1773
|
+
} else validHostNumericPortInvalid = true;
|
|
1774
|
+
} else validHostNumericPortInvalid = true;
|
|
1775
|
+
else if ((firstHostError === void 0 || !looksLikeIpv4(firstHostError.hostPart) && !looksLikeAltIpv4Literal(firstHostError.hostPart)) && (looksLikeIpv4(hostPart) || looksLikeAltIpv4Literal(hostPart))) {
|
|
1776
|
+
const hostResult = parseHost(hostPart);
|
|
1777
|
+
if (!hostResult.success) firstHostError = {
|
|
1778
|
+
hostPart,
|
|
1779
|
+
error: hostResult.error
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
searchFrom = separatorIndex;
|
|
1784
|
+
}
|
|
1785
|
+
if (validHostNumericPortInvalid) {
|
|
1786
|
+
const errorMsg$1 = options?.errors?.invalidFormat;
|
|
1787
|
+
if (errorMsg$1) {
|
|
1788
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1;
|
|
1744
1789
|
return {
|
|
1745
1790
|
success: false,
|
|
1746
1791
|
error: msg
|
|
1747
1792
|
};
|
|
1748
1793
|
}
|
|
1749
|
-
|
|
1794
|
+
return {
|
|
1750
1795
|
success: false,
|
|
1751
|
-
error:
|
|
1796
|
+
error: message`Expected a socket address in format host${separator}port, but got ${input}.`
|
|
1797
|
+
};
|
|
1798
|
+
}
|
|
1799
|
+
if (firstHostError !== void 0) {
|
|
1800
|
+
if (looksLikeIpv4(firstHostError.hostPart) || looksLikeAltIpv4Literal(firstHostError.hostPart)) {
|
|
1801
|
+
const errorMsg$1 = options?.errors?.invalidFormat;
|
|
1802
|
+
if (errorMsg$1) {
|
|
1803
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1;
|
|
1804
|
+
return {
|
|
1805
|
+
success: false,
|
|
1806
|
+
error: msg
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
return {
|
|
1810
|
+
success: false,
|
|
1811
|
+
error: firstHostError.error
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
}
|
|
1815
|
+
let hostOnlyResult;
|
|
1816
|
+
if (!requirePort || trailingSepHost !== void 0 || trailingSepHostError !== void 0) {
|
|
1817
|
+
hostOnlyResult = parseHost(trimmed);
|
|
1818
|
+
if (canOmitPort && hostOnlyResult.success) return {
|
|
1819
|
+
success: true,
|
|
1820
|
+
value: {
|
|
1821
|
+
host: hostOnlyResult.value,
|
|
1822
|
+
port: defaultPort
|
|
1823
|
+
}
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
if (trailingSepHost !== void 0 && hostOnlyResult !== void 0 && !hostOnlyResult.success) {
|
|
1827
|
+
if (canOmitPort) return {
|
|
1828
|
+
success: true,
|
|
1829
|
+
value: {
|
|
1830
|
+
host: trailingSepHost,
|
|
1831
|
+
port: defaultPort
|
|
1832
|
+
}
|
|
1752
1833
|
};
|
|
1834
|
+
const errorMsg$1 = options?.errors?.missingPort;
|
|
1835
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1 ?? message`Port number is required but was not specified.`;
|
|
1753
1836
|
return {
|
|
1754
1837
|
success: false,
|
|
1755
|
-
error:
|
|
1838
|
+
error: msg
|
|
1756
1839
|
};
|
|
1757
1840
|
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
const errorMsg = options?.errors?.missingPort;
|
|
1763
|
-
const msg = typeof errorMsg === "function" ? errorMsg(input) : errorMsg ?? message`Port number is required but was not specified.`;
|
|
1841
|
+
if (trailingSepHostError !== void 0 && hostOnlyResult !== void 0 && !hostOnlyResult.success) {
|
|
1842
|
+
const errorMsg$1 = options?.errors?.invalidFormat;
|
|
1843
|
+
if (errorMsg$1) {
|
|
1844
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1;
|
|
1764
1845
|
return {
|
|
1765
1846
|
success: false,
|
|
1766
1847
|
error: msg
|
|
1767
1848
|
};
|
|
1768
1849
|
}
|
|
1769
|
-
if (
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1850
|
+
if (looksLikeIpv4(trailingSepHostError.hostPart) || looksLikeAltIpv4Literal(trailingSepHostError.hostPart)) return {
|
|
1851
|
+
success: false,
|
|
1852
|
+
error: trailingSepHostError.error
|
|
1853
|
+
};
|
|
1854
|
+
return {
|
|
1855
|
+
success: false,
|
|
1856
|
+
error: message`Expected a socket address in format host${separator}port, but got ${input}.`
|
|
1857
|
+
};
|
|
1858
|
+
}
|
|
1859
|
+
if (!canOmitPort && !requirePort && hostOnlyResult !== void 0 && hostOnlyResult.success) {
|
|
1860
|
+
const errorMsg$1 = options?.errors?.missingPort;
|
|
1861
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1 ?? message`Port number is required but was not specified.`;
|
|
1862
|
+
return {
|
|
1863
|
+
success: false,
|
|
1864
|
+
error: msg
|
|
1865
|
+
};
|
|
1866
|
+
}
|
|
1867
|
+
if (!canOmitPort && !anySeparatorFound) {
|
|
1868
|
+
hostOnlyResult = hostOnlyResult ?? parseHost(trimmed);
|
|
1869
|
+
if (hostOnlyResult.success) {
|
|
1870
|
+
const errorMsg$1 = options?.errors?.missingPort;
|
|
1871
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1 ?? message`Port number is required but was not specified.`;
|
|
1773
1872
|
return {
|
|
1774
1873
|
success: false,
|
|
1775
1874
|
error: msg
|
|
1776
1875
|
};
|
|
1777
1876
|
}
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
const msg = typeof errorMsg === "function" ? errorMsg(input) : errorMsg
|
|
1877
|
+
}
|
|
1878
|
+
if (firstHostError !== void 0) {
|
|
1879
|
+
const errorMsg$1 = options?.errors?.invalidFormat;
|
|
1880
|
+
if (errorMsg$1) {
|
|
1881
|
+
const msg = typeof errorMsg$1 === "function" ? errorMsg$1(input) : errorMsg$1;
|
|
1783
1882
|
return {
|
|
1784
1883
|
success: false,
|
|
1785
1884
|
error: msg
|
|
1786
1885
|
};
|
|
1787
1886
|
}
|
|
1788
|
-
|
|
1887
|
+
}
|
|
1888
|
+
const errorMsg = options?.errors?.invalidFormat;
|
|
1889
|
+
if (errorMsg) {
|
|
1890
|
+
const msg = typeof errorMsg === "function" ? errorMsg(input) : errorMsg;
|
|
1891
|
+
return {
|
|
1892
|
+
success: false,
|
|
1893
|
+
error: msg
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
if (hostOnlyResult !== void 0 && !hostOnlyResult.success) {
|
|
1897
|
+
if (looksLikeIpv4(trimmed) || looksLikeAltIpv4Literal(trimmed)) return {
|
|
1898
|
+
success: false,
|
|
1899
|
+
error: hostOnlyResult.error
|
|
1900
|
+
};
|
|
1789
1901
|
}
|
|
1790
1902
|
return {
|
|
1791
|
-
success:
|
|
1792
|
-
|
|
1793
|
-
host: validatedHost,
|
|
1794
|
-
port: validatedPort
|
|
1795
|
-
}
|
|
1903
|
+
success: false,
|
|
1904
|
+
error: message`Expected a socket address in format host${separator}port, but got ${input}.`
|
|
1796
1905
|
};
|
|
1797
1906
|
},
|
|
1798
1907
|
format(value) {
|