{"name":"ip-bigint","version":"4.0.2","keywords":["ip","bigint"],"author":{"name":"silverwind","email":"me@silverwind.io"},"license":"BSD-2-Clause","_id":"ip-bigint@4.0.2","homepage":"https://github.com/silverwind/ip-bigint#readme","bugs":{"url":"https://github.com/silverwind/ip-bigint/issues"},"dist":{"shasum":"69c0b8fc011f4e9f2a48316fc5bf1adb6b75508f","tarball":"http://registry-npm.ywwl.com/ip-bigint/download/ip-bigint-4.0.2.tgz","fileCount":4,"integrity":"sha512-DkONqB66NLxiCRinDBow7qiNcw7Jr06nBTz05tqQ61sD9glCTveDzRzWhChjCPWYC7zvBvbtl+iZWUhb9EquCw==","signatures":[{"sig":"MEUCIQCP9sVo02Q/uek7FnjzF4a9CWHKyLt1/V5NhbopBG2GIAIgNs1fodPPWXEZO9XclYIuEh5bTslvq9pk47/QN0gqLOI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5853,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjINqwACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr3YQ/+PojGpYNJ1vly4fi034mRQu4tqa79JOLEAlvHL/qbkD1hw8D4\r\n6ESccU7INemgLFpzfP48FiR1u/h5Op9sc3e5F0hR1UpKcAy7+62cKMMCpQXa\r\nRkjqrsClhbBftOgjAD/uNNDqgZES6oM/W6u1guvBA+xKy9IJQ5+Q0NJxJ40E\r\nsU6yb39QJj6cwRcuGyDxYfDHcfLIanjRvuXxpm5uabkOpjR95SK6jbyEI9IV\r\nD+9mkARUuUl3k17lncIny9Mf5NAnNfiulGInkzt4Fkf5xVRlvKoEFW+k08kz\r\nDAjkBXH/5KLuqWDXjQNwljneNchnPYpV0siLWMM0ekHlldoXlrU0acLRnQNO\r\n3Nb9TWTF5SAOTpueQZdDp8+dJXgMmRmi/UEjs30ObzMtxCVPcdjsuLf/eGqL\r\n+qlHDHoacgK8ibhE9ddcaRltznhhQhNQmYmn43nrUA1MlK6JPxlz9x8c6P2r\r\n/p6Jgga+Isz7Jy0RRCbVlmDU1ib+CmkCtLNeDC/Cjl06qqY42FYXBbVBrxCb\r\n+mcbU+6PPPJVUBoiE+A7fpfIhSImKAr+fZ0Co+EMD55A99LqBb2Pa3iPnAWJ\r\nU+U/osc3b2qsapDqsCLDyHuYLJV4fhi5nCwKdg56KaNZbwXZwh2V0jds2pxo\r\nY+Bwp9ciB37jG/xj8tazVgEDOGu/zXtL1B4=\r\n=G1dH\r\n-----END PGP SIGNATURE-----\r\n","size":2686,"noattachment":false,"key":"/ip-bigint/-/ip-bigint-4.0.2.tgz"},"type":"module","engines":{"node":">=14"},"gitHead":"40f6f8593329e0c3f65da64164219ab09d7364e9","_npmUser":{"name":"silverwind","email":"npm@silverwind.io"},"repository":{"url":"git+https://github.com/silverwind/ip-bigint.git","type":"git"},"_npmVersion":"8.19.1","description":"Convert IPv4 and IPv6 addresses to native BigInt and vice-versa","directories":{},"sideEffects":false,"_nodeVersion":"18.8.0","dependencies":{"ip-regex":"5.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"29.0.3","eslint":"8.23.1","updates":"13.1.5","versions":"9.3.0","eslint-config-silverwind":"54.0.2"},"_npmOperationalInternal":{"tmp":"tmp/ip-bigint_4.0.2_1663097519926_0.33634521047514676","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":1663097520077,"maintainers":[{"name":"silverwind","email":"npm@silverwind.io"}],"_cnpm_publish_time":1663097520077,"dist-tags":{"latest":"10.0.4"}}