MCPcopy
hub / github.com/di-sukharev/opencommit / parseIPv4Number

Function parseIPv4Number

out/cli.cjs:3657–3683  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

3655 return specialSchemes[scheme];
3656 }
3657 function parseIPv4Number(input) {
3658 if (input === "") {
3659 return failure;
3660 }
3661 let R7 = 10;
3662 if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") {
3663 input = input.substring(2);
3664 R7 = 16;
3665 } else if (input.length >= 2 && input.charAt(0) === "0") {
3666 input = input.substring(1);
3667 R7 = 8;
3668 }
3669 if (input === "") {
3670 return 0;
3671 }
3672 let regex = /[^0-7]/u;
3673 if (R7 === 10) {
3674 regex = /[^0-9]/u;
3675 }
3676 if (R7 === 16) {
3677 regex = /[^0-9A-Fa-f]/u;
3678 }
3679 if (regex.test(input)) {
3680 return failure;
3681 }
3682 return parseInt(input, R7);
3683 }
3684 function parseIPv4(input) {
3685 const parts = input.split(".");
3686 if (parts[parts.length - 1] === "") {

Callers 2

parseIPv4Function · 0.85
endsInANumberFunction · 0.85

Calls 2

toLowerCaseMethod · 0.80
testMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…