{"name":"ip-cidr","version":"2.0.3","description":"Module for working with CIDR (v4, v6)","main":"./index.js","types":"./index.d.ts","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.9.4","jsbn":"^0.1.0"},"devDependencies":{"@types/ip-address":"^5.8.2","@types/jsbn":"^1.2.29","browserify":"^14.5.0","chai":"^3.5.0","mocha":"^6.2.0"},"repository":{"type":"git","url":"git+https://github.com/ortexx/ip-cidr.git"},"engines":{"node":">=5.0.0"},"gitHead":"569f6b26efdbc17ca64ac50099d6fa85ef5b5eb6","bugs":{"url":"https://github.com/ortexx/ip-cidr/issues"},"homepage":"https://github.com/ortexx/ip-cidr#readme","_id":"ip-cidr@2.0.3","_nodeVersion":"8.2.1","_npmVersion":"6.10.2","dist":{"integrity":"sha512-23bcPOKJ2ln55IL3izQ/JLo+7XCBsmmSQE8cWB8g2jVpTdXZA3/KDv08uoPAdpO++sfcACiI8jVuErxKzdeuvA==","shasum":"d03a5236c48ab983f1cdaa7d0a476b2f9792c709","tarball":"http://registry-npm.ywwl.com/ip-cidr/download/ip-cidr-2.0.3.tgz","fileCount":8,"unpackedSize":696521,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdPBDRCRA9TVsSAnZWagAA30UQAJdN0+rv0c59ekDh1rce\nUObvxgDeVZOAufqloILuPVtdctBP9N/6v9GtGR2iAVgfbJxJPJJZBTH3S6S4\nqMJaTDrrcpnov8EySK8plNqcyJzesylYBkmieGqAVCIvWPfWaGiFvpFs4B47\nn/3yr/LheCgcjYYJSWoaCn0DOyvA+WFErPUek+j3A1dPkwluDiIyt5CyAF1a\nUXNfBrnyShFrSI4BZZu00P+qHaDSdSVZdueS+BJqcn5pnd5CsndetmRrT60q\no8NXbBRX0crP6QIUq8NZqQ9Dq8FtYk8/mi7fyoDv/n2VQTY7jJacSgtdWewo\nrJLp0Un2M3IsZwpIJguHnxzpONnIQ30OvdPVcaq12LNcDLeIi+gsNBbn1k/K\nvq80WHBuYHZPnqS0JabAR3g1gaVkaixGJ7/uk9Iw8AIcS78JNv42P7bKSCGX\nTFgiwEgLlwgso9ORRabDiL6R7uWuQuxi3ev32EsEBrl3zNCpt5WkrZq3qJpy\nR9FZ783+TnofR6njTxI7PFDiWZy0NXHcYiTlIuQtfLcjFURQIB6Mo50FBKxn\nompk4MHxdrA0KhWM+39sWZ8QhrzO8ZZD+I/38BTiYQIlh4BWKAydjn4P99LU\nrD+uAtJ0+nsgmVpBW2Thh9MqJcNld80fyVyft3YTDC0R3N2OxhQCwBK3zj9C\nTq6k\r\n=3doT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGwyIlJ2UYUp/k3mzZcpFOXwVlx9+IsF/EmXbG1PtsePAiAnWbEchaiQLE+rU5gK39Bde6aL+gIynMlBV0/63T5FiA=="}],"size":133789,"noattachment":false,"key":"/ip-cidr/-/ip-cidr-2.0.3.tgz"},"maintainers":[{"name":"ortex","email":"mywebstreet@gmail.com"}],"_npmUser":{"name":"ortex","email":"mywebstreet@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ip-cidr_2.0.3_1564217552807_0.5251550314561966"},"_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":1564217552943,"_cnpm_publish_time":1564217552943,"dist-tags":{"latest":"4.0.2"}}