{"name":"ip-bigint","version":"6.0.0","keywords":["ip","ipv4","ipv6","ip-address","bigint"],"author":{"name":"silverwind","email":"me@silverwind.io"},"license":"BSD-2-Clause","_id":"ip-bigint@6.0.0","homepage":"https://github.com/silverwind/ip-bigint#readme","bugs":{"url":"https://github.com/silverwind/ip-bigint/issues"},"dist":{"shasum":"e0d673f8b460b9a21ff1f29d3bfe4a1743aad7ce","tarball":"http://registry-npm.ywwl.com/ip-bigint/download/ip-bigint-6.0.0.tgz","fileCount":4,"integrity":"sha512-68+9IteBghKVV49Aqw9Q5qnz4nF4wy1y63iN+DQSeJU75nO/NASEBFEg+mgfEK96p2m8yNWaFod4jP01pHObiw==","signatures":[{"sig":"MEQCIHnsWI7o0oCFvGQwBqgdXY49iORvdqYaDkYCG+VZufj9AiAZ4kG/VXNoagDjpLIUsJjZANs5ADsMpPaFi7DuHgi87A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6097,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjmNp2ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrI3g/8DejQeGpDhTsjP2G1tB9vg8nSCxo5XwPwO9bBbeEKGa7mFJUX\r\njBvb1DHR4lmuoD8tMyWyjxYGH3/ZWxw4gH6qSQTpre9hyiBva8KQWle+pXTN\r\naeLHM1F0k7bZWNunfzdLS21MPH8CQRy970BDwQ3N+izu1Ab0rtw7zEaB5PRC\r\nzBzKtLqf5SSnVxZep40OfBBDXWfZpmy4+iF0Oit81p+IpKetZ6qn7k6svt2u\r\n9QTDCZaq5mP+sKYfcXhGudwDdwyfYIDMR+v0eeJ/96hqVqTUM9qc+bir9600\r\ntzE4ZdeORwtX0cDTuEQPdLRMpopPA2Gpnj+zVHrf2TkZc5dUVIzFLMzy/H4A\r\ng49kUDMnyhfMd+MpXf/VkqKxc0lAmbkq1D42yVoWnxZ400hrkfL0PNju3yb8\r\n7E1fYSSEKXq5SUg92MHa0UPM1Xb4E6h2KQ7nE/sDvTVlZMwowPaWg1Qhxu7x\r\noeSCYbasYc7TWRJY0d36TXc0ZPS1tacDdqWyoN6/SNaZEiMkVCS8ok91a1QF\r\nbhhlrEbLjLaesaab078aE2ovQxJO0kK73qTturHCz1/7fyiZuqxmLvNw/fYC\r\nPGfsqhPr0C1WQaGKDWKfem05sa3JE8AX4I4VHZkIaLcH8FefodlInxuCMRHV\r\nSGiNRgjAanpsrU9SrBOjGwHiZ9mVBDmeaB0=\r\n=UDIq\r\n-----END PGP SIGNATURE-----\r\n","size":2777,"noattachment":false,"key":"/ip-bigint/-/ip-bigint-6.0.0.tgz"},"type":"module","engines":{"node":">=14"},"exports":"./index.js","gitHead":"2677b74fe5c9ad9fd4a018241787641bde77d57d","_npmUser":{"name":"silverwind","email":"npm@silverwind.io"},"repository":{"url":"git+https://github.com/silverwind/ip-bigint.git","type":"git"},"_npmVersion":"8.19.3","description":"Convert IPv4 and IPv6 addresses to native BigInt and vice-versa","directories":{},"sideEffects":false,"_nodeVersion":"19.2.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"8.28.0","vitest":"0.25.3","updates":"13.2.1","versions":"10.2.4","eslint-config-silverwind":"63.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ip-bigint_6.0.0_1670961782078_0.09723060170727615","host":"s3://npm-registry-packages"},"readme":"# ip-bigint\n[![](https://img.shields.io/npm/v/ip-bigint.svg?style=flat)](https://www.npmjs.org/package/ip-bigint) [![](https://img.shields.io/npm/dm/ip-bigint.svg)](https://www.npmjs.org/package/ip-bigint) [![](https://img.shields.io/bundlephobia/minzip/ip-bigint.svg)](https://bundlephobia.com/package/ip-bigint) [![](https://packagephobia.com/badge?p=ip-bigint)](https://packagephobia.com/result?p=ip-bigint)\n\n> Convert IPv4 and IPv6 addresses to and from BigInt\n\n## Usage\n\n```js\nimport {parseIp, stringifyIp, normalizeIp} from \"ip-bigint\";\n\nconst obj = parseIp(\"2001:db8::\");\n// => {number: 42540766411282592856903984951653826560n, version: 6}\n\nstringifyIp(obj);\n// => \"2001:db8::\"\n\nnormalizeIp(\"2001:db8::0:0:1\");\n// => \"2001:db8::1\"\n```\n\n## API\n\n### parseIp(ip)\n\nParse a IP address string to a object (with null prototype).\n\nFor IPv4 returns `{number, version}`.\nFor IPv6 returns `{number, version, [ipv4mapped], [scopeid]}`.\n\nThere is only rudimentary validation that the passed string is actually an IP address. You are encouraged to validate yourself using modules like [`ip-regex`](https://github.com/sindresorhus/ip-regex).\n\n### stringifyIp({number, version, [ipv4mapped], [scopeid]}, [opts])\n\nConvert a parsed object back to an IP address string.\n\n`opts`: Options `Object`\n  - `compress`: Whether to compress the IP. For IPv6, this means the \"best representation\" all-lowercase shortest possible form. Default: `true`.\n  - `hexify`: Whether to convert IPv4-Mapped IPv6 addresses to hex. Default: `false`.\n\n### normalizeIp(ip, [opts])\n\nRound-trip an IP address through `parseIp` and `stringifyIp`, effectively normalizing its representation.\n\n`opts`: Options `Object`\n  - `compress`: Whether to compress the IP. For IPv6, this means the \"best representation\" all-lowercase shortest possible form. Default: `true`.\n  - `hexify`: Whether to convert IPv4-Mapped IPv6 addresses to hex. Default: `false`.\n\n### max4\n\nA `BigInt` value that holds the biggest possible IPv4 address.\n\n### max6\n\nA `BigInt` value that holds the biggest possible IPv6 address.\n\n### ipVersion(ip)\n\nReturns a integer of the IP version, 4, 6 or 0 if it's not an IP. Very rudimentary and should not be used for validation.\n\n## Related\n\n- [ip-regex](https://github.com/sindresorhus/ip-regex) - Regular expression for matching IP addresses\n- [is-cidr](https://github.com/silverwind/is-cidr) - Check if a string is an IP address in CIDR notation\n- [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address\n- [cidr-regex](https://github.com/silverwind/cidr-regex) - Check if a string is an IP address in CIDR notation\n- [cidr-tools](https://github.com/silverwind/cidr-tools) - Tools to work with IPv4 and IPv6 CIDR network lists\n\n## License\n\n© [silverwind](https://github.com/silverwind), distributed under BSD licence\n","publish_time":1670961782292,"maintainers":[{"name":"silverwind","email":"npm@silverwind.io"}],"_cnpm_publish_time":1670961782292,"dist-tags":{"latest":"10.0.4"}}