{"name":"ip-bigint","version":"1.0.0","keywords":["ip","bigint"],"author":{"name":"silverwind","email":"me@silverwind.io"},"license":"BSD-2-Clause","_id":"ip-bigint@1.0.0","homepage":"https://github.com/silverwind/ip-bigint#readme","bugs":{"url":"https://github.com/silverwind/ip-bigint/issues"},"dist":{"shasum":"dd09d91ffa00db94c1db33452271eed59dd9ff8b","tarball":"http://registry-npm.ywwl.com/ip-bigint/download/ip-bigint-1.0.0.tgz","fileCount":4,"integrity":"sha512-ctgFZobZCGmH+4V+bdApmWPurBjEDdZWkw60WgOMn3xTH9jrOUU6dfssTsYjBPRZ6+QOBtYiFnOverLPMIJcbA==","signatures":[{"sig":"MEUCIHS6HuQIImbNxxRop+izk4rvL4tFc9Cd3zCh8/hnfZ5RAiEAm0df5DX1y0WT22YDLNJNFG6+NekO1WXU4/RpJ/ZkhJw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4950,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdIf0/CRA9TVsSAnZWagAAcOAP/R9rykWqYOXT/1WbZSDS\nsvgThRME7l2Rby/2v9EjMsuCBgDRa+WB+QM0wSb22kEtM35zp8mTKlq0DvUN\ng5uL1gWHFjLcr172YHu9ppxoTumVohQC9WQe/uLM5D9aVswSALCjRcVkaemW\nBUYTztBH0oaMHp9gimdgxJP9keWaSLnzk1mh665UYv1gVqogcbLOwE3C2Ruq\n5UOSzvM2m6Dqc+FnhQGT2DBJp35dnM4iGW+jAWjW6VI4l6D7J6CltM9PQ1ho\nm9+CyCu1HHS66GWFSjW+phGDPVMaoTes1CV+t8rbIWz19BLJIq5nlNqAr5yy\nR998AadJAJ9Qnj0YztZgnzex6/9U6CHnnrgCyUXybQ+PchWJ6psqGQaMZNdr\nOUgYJqRsRIGYMi8ss211rl0g6jYE5A3cyxu/kdrkagqNH2r6xPn1CNonaO10\n4z+CQ/FYJW3dCKT2BezCOTR4RWBdPUo446fPi32YEBLIGLRCR6itHyZATuVG\nd0YKVnE3ocLxx5xybQW2jJGoUwhs43o4RkxVFp6OL1q7UzIvE+azwg9zVeL0\nSOczzqspPTzv6ut/EyFiw892Yl0TY/gcmwu+ubjjG5XkmLf2CK9hpXSbzjqU\nJ9HzfrNGqmVwduXo4Pp5uNZZ7yum1xkwsu3n4hQKkqgB2qE0oc0eFEbm2u0e\n8Grv\r\n=y2Ux\r\n-----END PGP SIGNATURE-----\r\n","size":2324,"noattachment":false,"key":"/ip-bigint/-/ip-bigint-1.0.0.tgz"},"engines":{"node":">=10.4.0"},"gitHead":"d96bccd2b3b657b08bde825dd39b34b12cf8c3aa","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.0_1562508606779_0.6646426428701921","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":1562508606875,"maintainers":[{"name":"silverwind","email":"npm@silverwind.io"}],"_cnpm_publish_time":1562508606875,"dist-tags":{"latest":"10.0.4"}}