{"name":"ip-bigint","version":"2.0.1","keywords":["ip","bigint"],"author":{"name":"silverwind","email":"me@silverwind.io"},"license":"BSD-2-Clause","_id":"ip-bigint@2.0.1","homepage":"https://github.com/silverwind/ip-bigint#readme","bugs":{"url":"https://github.com/silverwind/ip-bigint/issues"},"dist":{"shasum":"110a46aa7701f96d9fdcda4f490e1b3696adfbe1","tarball":"http://registry-npm.ywwl.com/ip-bigint/download/ip-bigint-2.0.1.tgz","fileCount":4,"integrity":"sha512-XclrCQBr2Re3nwkZatcudo3oUYVHrJ63wTXxFrgz8OPkzaAOhJsVKMk/57hAciii8QuRa6VycSuUxfHefp/b3A==","signatures":[{"sig":"MEYCIQCtppYbTJOZeOBoHipZZSMiTWfhoAB4mBL1mIQOPayr5QIhAKN61Zki0RtG/8Ys0uZy9/TC9UWPxrBOtApAL7I51iOp","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5967,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfQPjBCRA9TVsSAnZWagAALccP/10QMs28BYDX/CLzKl5X\nIXxPW6EcEYRG3p2vz+G7Yxcjo86gRKDL38OuIh4ov81dfrAgjhYl0XunKoRz\nsw1TRFdnxIN1qBGbs9XkBPby17WvadNB4YDnkoIbhS5I0CWIpp+NltQM1m/Y\nRbABWTDeEFraWNmkShBEKn+xVSkuheduhFCb2f4t0I8BwC9HOpBksSXcG5mY\nFl7V2GYrKNY00VR7G2wKUOjbaLU22Vc98w+mLaFBXYjqWiH2WhXsN69aORjK\naGdQSox28ziav2+b/PaIoEXddS+EPOvUT+UGSH05XExRGJQ5w0NxJhxnOeZm\nL5kdMvB44+5L3wJShHKoNOhS6N2bqTcgX0H7WvM6Ygo8LpY+mxK4q144sRjp\nbshuDg+9CcBorLFldCtjn76vIPN22xb9WopD92yNLdTnF7EVIvh6GLpF0/Mp\nnyDoOsCtTXScPZtPJb/ZlvSzGNS2suGGnMDNpIXM6+waw+r3aafn8NUHkL6s\nyLR+3FMuq0Hb2tWIgZMsW1p2k+bQH+ETgo0mj+w7svtOeI8/XnRNVJpNH6ey\n+tCYuaVLJsEkgluSupKHqsUiBQTZb/z8XKdeWGHpj2H8GfwcKkYjQxHcbaoE\nZOZhW3e5qsUMI20PfyKqwndtt3ILwW05JO2V6T/H3jQdggMv5X9oNwxA/3lk\nHluk\r\n=kTgf\r\n-----END PGP SIGNATURE-----\r\n","size":2687,"noattachment":false,"key":"/ip-bigint/-/ip-bigint-2.0.1.tgz"},"engines":{"node":">=10.4.0"},"gitHead":"b22dfefead6a8cdcef9017e50d9267d409365ebb","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.14.7","description":"Convert IPv4 and IPv6 addresses to native BigInt and vice-versa","directories":{},"_nodeVersion":"14.8.0","dependencies":{"is-ip":"3.1.0","ipv6-normalize":"1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"26.4.1","eslint":"7.7.0","updates":"10.3.5","versions":"8.4.3","eslint-config-silverwind":"18.0.3"},"_npmOperationalInternal":{"tmp":"tmp/ip-bigint_2.0.1_1598093505562_0.15832743643865133","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":1598093505682,"maintainers":[{"name":"silverwind","email":"npm@silverwind.io"}],"_cnpm_publish_time":1598093505682,"dist-tags":{"latest":"10.0.4"}}