{"name":"ip-bigint","version":"1.0.1","keywords":["ip","bigint"],"author":{"name":"silverwind","email":"me@silverwind.io"},"license":"BSD-2-Clause","_id":"ip-bigint@1.0.1","homepage":"https://github.com/silverwind/ip-bigint#readme","bugs":{"url":"https://github.com/silverwind/ip-bigint/issues"},"dist":{"shasum":"e7a7ad99967a98ae272bde987af85d1b5cfdb2e8","tarball":"http://registry-npm.ywwl.com/ip-bigint/download/ip-bigint-1.0.1.tgz","fileCount":4,"integrity":"sha512-A0siFPQSvySHk90Z8s5jpdmWhkov9VqAlrA94Egke34y58l50ke2HpBOLKukdeiQGJ4oTCNkWq32D32n5CO+Nw==","signatures":[{"sig":"MEYCIQDQ9LsxL2DSxyOP6c0RaxtZegAQZDy8DchtqlONtu/UyAIhAOhnywQWTmJRGVy6Fq8iBp/HVH4ZTveWteVxZV78/Yoo","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4873,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdIumKCRA9TVsSAnZWagAABUcP/2+vxlv+BhqyniJNsS/Y\nRMN+S5JFHZT5LtnCLG4JOloyTWPwQ0bLnuIxDxhCCbrVeJC2eJhByQ5Vof1A\nAf5kco53IQY6IJTToohkMAQrrD+HpZlDS6aeIsr/yDrq0cpGOVWMALXLep0r\nCZwKNHSlHF6GhwjCYxAqevqa+zBV2bdPI85oUOpY5mnsXIRfMNPWRx6NwlNR\nVAx4u6TsjeQkKhDowVMYA7P2sSbC2OgxdUH9jrxuoqNcUc5fDEKWn2asZFss\nmeBMYpy5ahnsubC2+ELe/NgXqKOg3dvDbYYt8Cq9sF+PpB96Of7VPO7II7np\nV3RkEqU4ltIP9sogU5K1YCsK1kCEjIFjs0PaTIuXU2wTiU7tcVeIlqyjAmt6\nDaoWAV8CQ5DBmdwx29atG0Go29eRxjSQAw3N8Eksj+dWOlGruKVWbbI8LWe2\npzGm5UEKaIwpk9fmWLBZbZb1zSfQrjVkqV7UvNxb0gjwuyoNKhWS04a92Smf\nZsFYsuRsolfB/r8E0pU/jl/yL9AWXTco2MIrpnhUnvxvZpeixnp9Te7by5cV\nZc/CkKQfYuDmGXUoyPZpW12zseuBqQhJQqf2hx6mwtcq2otCQNUcg8FD2PFH\nKB84TeDHKkqBg9kSyFH3rOMmtKy1pfg78Cg4pMBEWiurh5JDSuZ1gF98kq0V\n/AIA\r\n=Dn8h\r\n-----END PGP SIGNATURE-----\r\n","size":2311,"noattachment":false,"key":"/ip-bigint/-/ip-bigint-1.0.1.tgz"},"engines":{"node":">=10.4.0"},"gitHead":"15462c2d5be087307484f2254f974b57608596ed","scripts":{"test":"make test"},"_npmUser":{"name":"silverwind","email":"npm@silverwind.io"},"repository":{"url":"git+https://github.com/silverwind/ip-bigint.git","type":"git"},"_npmVersion":"6.9.0","description":"Convert IPv4 and IPv6 addresses to native BigInt and vice-versa","directories":{},"_nodeVersion":"12.5.0","dependencies":{"is-ip":"3.1.0","ipv6-normalize":"1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"ver":"5.0.2","eslint":"6.0.1","updates":"8.2.0","eslint-config-silverwind":"4.0.2"},"_npmOperationalInternal":{"tmp":"tmp/ip-bigint_1.0.1_1562569097670_0.23407314833399684","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":1562569097781,"maintainers":[{"name":"silverwind","email":"npm@silverwind.io"}],"_cnpm_publish_time":1562569097781,"dist-tags":{"latest":"10.0.4"}}