{"name":"ip-cidr","version":"2.0.1","description":"Module for working with CIDR (v4, v6)","main":"./index.js","author":{"name":"Balasyan Alexandr","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"},"dependencies":{"ip-address":"^5.8.6","jsbn":"^0.1.0"},"devDependencies":{"browserify":"^14.4.0","mocha":"^3.2.0","chai":"^3.5.0"},"repository":{"type":"git","url":"git+https://github.com/ortexx/ip-cidr.git"},"engines":{"node":">=5.0.0"},"gitHead":"19f1a68f20ef77a7e111c530f7c66dd19eade78a","bugs":{"url":"https://github.com/ortexx/ip-cidr/issues"},"homepage":"https://github.com/ortexx/ip-cidr#readme","_id":"ip-cidr@2.0.1","_npmVersion":"6.4.1","_nodeVersion":"8.2.1","_npmUser":{"name":"ortex","email":"mywebstreet@gmail.com"},"dist":{"integrity":"sha512-2Ywhb9ZECa4Gl1gMfBEr7IGlb2d8s2GCG/q55U7MUZRB3KfVnsWg42VxK6mugDdJuHsHdJpiFsZJsMTUKnUgEQ==","shasum":"554377b21ab51a223fba0ccea2d6006986804afe","tarball":"http://registry-npm.ywwl.com/ip-cidr/download/ip-cidr-2.0.1.tgz","fileCount":7,"unpackedSize":309864,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcAPeDCRA9TVsSAnZWagAAb+kQAJjHScXycKYapBR83V/6\nEzkJT+yIFVxCoexiE3mDEKMF4R/s6kUIF7MVhn4kGHTbxxvy0OfG1I76Muvm\njkA3aHIt7Q8RBa+S02nq3UFTuxrYjlxq6rvmV2kiBnSBptGRNJx7qJP8YqNx\n4EI39MAf9KibhT1knXEX4cW7+k8zihir/7IgZl6TJM0ijwl48SwYlBFAAsXL\n/IluYg86dkHuHX/hfduDlaZNOR+o1VrvejEbxR805hYWWbxK2WtofOAxvFH9\n++N45p2upMzDRKqVw7pa9RCAZeXAzCQXzivPEEaa0Y+ao9iUCdqC0KsxWuUV\n3ApekaNuKy83D3zXrVzzgtRdXeXUx5vh8hiQagxr1cY6GLG/BPMF7Eg1xShb\nE/hOBN2YttT593QKYGfr+VAc35VqKzIedgYudu4pWlxxS9LmmJAvYKCt4SlU\n19OXGpZYYJ8/32vckJrJqA0EAx9T6Wbyj+IijZlHZucTMErF8DRl2uam85/a\nMLAch3JbM1oe1tVbvngGvJqMpwf3qSRDAzNei1ejZfmzfBSDEpXI3IqVLwZt\nzmXoiSxIrMQYTDAz4w7xxtSHcvWIMJJTkANLHjjwLLvOO/6Y7N3V64Yd4JaI\nC8lA7JRgt4qAd3mytecSCwGARKgztPTXbFYkX+mAOE+TpbyRhE15ygTIrrsu\nC10p\r\n=4QsB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDa6txEBruoZ39LfGXLL+xnEw8Y1Mmj6utuvrXRuGSZFQIgaFTenj2KsvKV5dSErPVG0dzgoRayrhtF3Bw4y/waldo="}],"size":67681,"noattachment":false,"key":"/ip-cidr/-/ip-cidr-2.0.1.tgz"},"maintainers":[{"name":"ortex","email":"mywebstreet@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ip-cidr_2.0.1_1543567234858_0.4428732387520242"},"_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":1543567235046,"_cnpm_publish_time":1543567235046,"dist-tags":{"latest":"4.0.2"}}