{"name":"ip-cidr","version":"2.0.0","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":"659774d32d10f2dc3e4173555d317e4b52df4c19","bugs":{"url":"https://github.com/ortexx/ip-cidr/issues"},"homepage":"https://github.com/ortexx/ip-cidr#readme","_id":"ip-cidr@2.0.0","_npmVersion":"6.0.0","_nodeVersion":"8.2.1","_npmUser":{"name":"ortex","email":"mywebstreet@gmail.com"},"dist":{"integrity":"sha512-RG2+JvxGxdrZ4vJkn0pk2wpOhywTNxxvcLW2/1wqFTMpuk2fzTagZbU33ztlgF0pwRkSmSMo0kaNCCSazJr7Rw==","shasum":"923009291b65797f0a6462b220063060091c334c","tarball":"http://registry-npm.ywwl.com/ip-cidr/download/ip-cidr-2.0.0.tgz","fileCount":7,"unpackedSize":307758,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbClDyCRA9TVsSAnZWagAAHOoP/10TkvuTm2MvyI3O3hFA\n8mlhphLwkH7B+uS+28qguk56TAMxZS02ACsK6wqZ/ayx8xkQBEOW9+JWEiW3\nXpshDhs5UhRBXlOzmINR+kBJf6OyO9/qYkxs2F+t1a2F9CBD9aFOd13AVTbF\n1xpyIU6nLsEcT2qKYMi8QioaCMUyuokQTbAIptyAPUFs4aTdY7myfwc0dIFc\noCE+mh7qTcWB43+JaWGZSsQuwGVMk69zsKJ57Xb2TWtiW7QBgIHS2TCUP/sZ\neo0hpPZv276r0GoNUqmXsvKu16wWTV04K/T4Xwu7MVz8miqMM8PFum32vkif\nCxwudpBTB6vFruVWjMw0xOEBgdupVbNc5h2O21q31Y4CBamHk+Dpodk1lsrG\n6xBNCWagBhyBr0ASvxe7V0Hb2yvvyoHxT8bel8aeJtl2qcCSc/1BMgCWdfsM\nmn3wOYUy2r0IqE6hCo2JmjigK9ytK4M6bYWrTJV1Nas5RnFUOkuyP9BHsHwy\n8v+JKKqHUwop2lmTxuq408EMuTWgNKh0KH4ai7EL6wyqRX+aCcSktvUS3B60\nsBOZFNF7zsKHcECJ65kjJIdaitbdO7fQBqRBy+XZUcwW+6bqCNH12Aeo1Sb8\nPmHbcvMT981xFB3TWPqZCRmlf88wKUgZI5mFfNlc0ma7r1XAOoWoPerrU5+Z\n0Sv0\r\n=aseM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDs4O2/FSZ8/E+viCcHxJLLwGvdHg5VzsrQSMX2XIdEQgIgB8bSAX5UZvLoYPLmBbGeOQmVwEX7NHQWdckwiyCVBP8="}],"size":67439,"noattachment":false,"key":"/ip-cidr/-/ip-cidr-2.0.0.tgz"},"maintainers":[{"name":"ortex","email":"mywebstreet@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ip-cidr_2.0.0_1527402738183_0.5467016308745067"},"_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":1527402738299,"_cnpm_publish_time":1527402738299,"dist-tags":{"latest":"4.0.2"}}