{"name":"ip-cidr","version":"3.0.4","description":"Module for working with CIDR (v4, v6)","main":"./index.js","types":"./index.d.ts","author":{"name":"Alexander Balasyan","email":"mywebstreet@gmail.com"},"keywords":["ip","cidr","range","from","to","array"],"license":"MIT","scripts":{"test":"mocha","build":"browserify ./ip-cidr.js > ./dist/ip-cidr.js"},"husky":{"hooks":{"pre-commit":"npm run test && npm run build && git add ./dist/*"}},"dependencies":{"ip-address":"^7.1.0","jsbn":"^1.1.0"},"devDependencies":{"@types/jsbn":"^1.2.29","browserify":"^14.5.0","chai":"^3.5.0","husky":"^4.2.3","mocha":"^7.1.1"},"repository":{"type":"git","url":"git+https://github.com/ortexx/ip-cidr.git"},"engines":{"node":">=10.0.0"},"gitHead":"13840f176e19de54c0da47e87f99c1432f1b5c1b","bugs":{"url":"https://github.com/ortexx/ip-cidr/issues"},"homepage":"https://github.com/ortexx/ip-cidr#readme","_id":"ip-cidr@3.0.4","_nodeVersion":"12.19.0","_npmVersion":"7.16.0","dist":{"integrity":"sha512-pKNiqmBlTvEkhaLAa3+FOmYSY0/jjADVxxjA3NbujZZTT8mjLI90Q+6mwg6kd0fNm0RuAOkWJ1u1a/ETmlrPNQ==","shasum":"a915c47e00f47ea8d5f8ed662ea6161471c44375","tarball":"http://registry-npm.ywwl.com/ip-cidr/download/ip-cidr-3.0.4.tgz","fileCount":9,"unpackedSize":135039,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhEq1VCRA9TVsSAnZWagAAhrEP/RDoODxpUzqU59fEh9Al\nw/StG4cHEOV2y1surYiD944yXHwLs35HXzcztf/NJzncsKodQ52GBcKRrwjB\n2WZzO5Mu687p2rt/VoAN7Z7KYuFsk5MwWLAHgy0CpytZBC7VCqA7XVSOQvOB\nRMIiLJHQG2CAp0vqi1bkqfZYypv1TQR1gLa+NnY/eOkqZhpATGFqSp156/MO\n0El3xFJymtK+CqtsUTdtw0y2aNxHJcFvz9V2Y1TU3vperrHITRscK8a9L+6f\nrFPaDJt7eIjNniiFGjjLk7NyaWnTEZcnKNng9ZPaBHlMoVRl1+Fz77QOHLcq\n1kbspWTNRhsldM3H84ewWFIVbgfZY7A2NtUFZunc/q033d44OkoEUNfVM6vk\nH5AhjLgx+wB9dGrsj4dl0tJN3gOSQQ/ZknAV4uEBC6aq+Esp3n4lDAEaJdUF\nIO5Jqr4WVGJNyH1F+zPzi73cwfzTWOOgTnHX6xeualW8BIDHfUxV62Pf03Bd\n2tx728KEOGlpFbhtqOaIsI/+Kq8jv8W9ic9kkb4VD1SXSPvC8dz4IqIUfgbo\ndFu41fAMDKX5nWZNMFgh59xWzT4LxfT4PZzhk+spum2zFwarlM4kF4BiI8Ih\n6JTMKNJF3x7cXgc0bATKE6br6tVjobefMu/h3qJQ3gAEGbzU/LjjIV8kOlhH\nmYJZ\r\n=q3Ed\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFJgu6vq3IFL99TJOPVszXzF2hN/DnGXNv33M8wYpsMtAiEA+t0Sc3OlGqeNqf4lPN8jPvycSXrnw8H+vVbnYUwhKbI="}],"size":29524,"noattachment":false,"key":"/ip-cidr/-/ip-cidr-3.0.4.tgz"},"_npmUser":{"name":"ortex","email":"mywebstreet@gmail.com"},"directories":{},"maintainers":[{"name":"ortex","email":"mywebstreet@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ip-cidr_3.0.4_1628613973648_0.6168640213990548"},"_hasShrinkwrap":false,"readme":"# Install  \n`npm install ip-cidr`\n\n# About  \nModule for working with CIDR (v4, v6). Based on [ip-address](https://github.com/beaugunderson/ip-address).\nSince v4+ using javascript BigInt for big numbers handling.\n\n# Example  \n\n```js\nconst IPCIDR = require(\"ip-cidr\");\nconst address = \"50.165.190.0/23\";\n\nif(!IPCIDR.isValidCIDR(address)) {\n  return;\n}\n\nconst cidr = new IPCIDR(address); \n\n// get start ip address as a string\ncidr.start(); \n\n// get end ip address as a big integer\ncidr.end({ type: \"bigInteger\" }); \n\n// do something with each element of the range  \ncidr.loop(ip => console.log(ip), { type: \"addressObject\" });\n\n// get an array of all ip addresses in the range as a big integer;\ncidr.toArray({ type: \"bigInteger\" }); \n\n// get an array by chunks using from/limit\ncidr.toArray({ from: 1, limit: 2n });\n\n// get an array by chunks using from/to\ncidr.toArray({ from: BigInt('1'), to: 3 });\ncidr.toArray({ from: '50.165.190.1', to: '50.165.190.3' });\n\n// get an array of start and end ip addresses as a string [startIpAsString, endIpAsString]\ncidr.toRange(); \n```\n\n## Client side\nLoad __/dist/ip-cidr.js__ as a script and you can get the library in __window.IPCIDR__\n\n# API  \n### .formatIP(address, [options])  \nto return an \"ip-address\" module object in the necessary format \n\n### .isValidAddress(address)  \nto check the address is valid or not (ip or cidr)\n\n### .isValidCIDR(address)  \nto check the address is valid (only cidr)\n\n### .createAddress(address)  \nto create an object address from the string\n\n### .prototype.contains(address)  \nto check the address belongs to the range\n\n### .prototype.start([options])  \nto get the start ip address\n\n### .prototype.end([options])  \nto get the end ip address\n\n### .prototype.toString()   \nto convert the cidr to a string like \"50.165.190.0/23\"\n\n### .prototype.toRange([options])  \nto convert the cidr to an array with start and end ip addresses [startIp, endIp]\n\n### .prototype.toObject([options])   \nto convert the cidr to an object with start and end ip addresses {start: startIp, end: endIp}\n\n### .prototype.toArray([options], [results])  \nto convert the cidr to an array with all ip addresses in the range  \nyou can get information by chunks using **options.from/options.limit** or **options.from/options.to**  \nyou can pass the second argument \"results\" (object) to get all chunk pagination information\n\n### .prototype.loop(fn, [options], [results])  \nto run __fn__ for each element of the range  \nyou can use the same chunk options as in __.toArray()__\n\n\n\n","publish_time":1628613973810,"_cnpm_publish_time":1628613973810,"dist-tags":{"latest":"4.0.2"}}