{"name":"ip-cidr","version":"3.0.10","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":"^9.2.0"},"repository":{"type":"git","url":"git+https://github.com/ortexx/ip-cidr.git"},"engines":{"node":">=10.0.0"},"gitHead":"6fab3b76fee2714cf64c3b410650a8bbdfffc87e","bugs":{"url":"https://github.com/ortexx/ip-cidr/issues"},"homepage":"https://github.com/ortexx/ip-cidr#readme","_id":"ip-cidr@3.0.10","_nodeVersion":"16.9.1","_npmVersion":"8.1.3","dist":{"integrity":"sha512-PXSsrRYirsuaCI1qBVyVXRLUIpNzxm76eHd3UvN5NXTMUG85GWGZpr6P+70mimc5e7Nfh/tShmjk0oSywErMWg==","shasum":"e1a039705196d84b43858f81a243fd70def9cefc","tarball":"http://registry-npm.ywwl.com/ip-cidr/download/ip-cidr-3.0.10.tgz","fileCount":9,"unpackedSize":136861,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5BFLh+qK7/nlZE8yH5cNA/ZXIx5P1fdAq7hST2RkMyQIhANlYdj0Hy+DR6HStug2YYAQnoyaZeyCqXgdmaUrMkqGW"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJikHuQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpXUxAAh/d+tBFsb9J4WM6wcSnv3LqXBNowniVnLICGe23iP7rV7j+h\r\ngxSpE7v2ZB4WGep8WqF75IFV7mn8YIxkwcrg2Od79kjh5k+rsp+ujnl7Pc7T\r\nE5rpxdo1NBD/8kCKyMKIkz4mrHvYFQwEndwHxtWPO4AmL+QMww7yzAj5nhHj\r\n5Th6yOJfHMdsbJRkU9h8EG+1p+3hlv12f4ZxNwaogcv2v+mXL/hgVyxBBFWR\r\n/xNi8FP3ZVdVkxC8uYxVSUZyVhg6+K6xsgtjYI0cvKnNZPrkANWyroee8fXv\r\nJCa+tJDpns3PjU0m4U1lKqZS1ml4pj+yA1jPszQnhGol7OU7jyC7L7GBrof2\r\nymJ1NDEJ76JS9ETzkyiBEfGISY2bn2aHt+RwN1+iJdTuIDm7Tetmz739ppoX\r\nph6+UiU1YSowSY0VETkRiLXWC3S3bqForiWwWcoyEigboOb8R0/Gw4wJcg/x\r\nA7mi3UZP2Busf1efbv4wK/R2C38rLs3FBV3ev0SLHkbDCcABCkcRM9HyEevZ\r\nrp31iVpQzHYFKSudXKaKClpV07AP1rHdnr0kAK25sN4QUcOP2t7XiCCxBQL8\r\n9IS9kvSnWzu/Td30xxhC40apB62BNamNMcVoaHD9tYXAoisLEvdooPRHO3en\r\nwMMS6rcLpPorOGZNkTjMUoJsETHmqsVl9VI=\r\n=w2a2\r\n-----END PGP SIGNATURE-----\r\n","size":29716,"noattachment":false,"key":"/ip-cidr/-/ip-cidr-3.0.10.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.10_1653635984630_0.8944213251655793"},"_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":1653635984791,"_cnpm_publish_time":1653635984791,"dist-tags":{"latest":"4.0.2"}}