MCPcopy
hub / github.com/lionsoul2014/ip2region / parseIP

Function parseIP

binding/javascript/util.js:137–147  ·  view source on GitHub ↗
(ipString)

Source from the content-addressed store, hash-verified

135// @param ip string
136// @return Buffer
137export function parseIP(ipString) {
138 let sDot = ipString.indexOf('.');
139 let cDot = ipString.indexOf(':');
140 if (sDot > -1 && cDot == -1) {
141 return _parse_ipv4_addr(ipString);
142 } else if (cDot > -1) {
143 return _parse_ipv6_addr(ipString);
144 } else {
145 throw new Error(`invalid ip address '${ipString}'`);
146 }
147}
148
149// ---
150

Callers 2

searchMethod · 0.90
searcher.test.jsFile · 0.90

Calls 2

_parse_ipv4_addrFunction · 0.85
_parse_ipv6_addrFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…