{"name":"ip-cidr","version":"2.0.15","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":"^6.3.0","jsbn":"^0.1.0"},"devDependencies":{"@types/ip-address":"^5.8.2","@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":">=5.0.0"},"gitHead":"01e63d4b526153c948d2dfd8e8df1c7a34394fe6","bugs":{"url":"https://github.com/ortexx/ip-cidr/issues"},"homepage":"https://github.com/ortexx/ip-cidr#readme","_id":"ip-cidr@2.0.15","_nodeVersion":"12.12.0","_npmVersion":"6.14.6","dist":{"integrity":"sha512-v8ScBDs/yjkmG2UpJt8Fij3Cm6jcuyW9Sw+UO73HnKWwe7AR773XPc6WSkVoxsm9q2583FyH/Z2V+9ztgDrXGQ==","shasum":"6fba6b9849b55582393d49c9d9cc58a344e8e955","tarball":"http://registry-npm.ywwl.com/ip-cidr/download/ip-cidr-2.0.15.tgz","fileCount":8,"unpackedSize":306829,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfEAQcCRA9TVsSAnZWagAA+ncP/0llpGVWTjTUbGQ5b09t\nz6Ku4Jr7N5BwL7zvijw5W7WWklvYm2w7Icx9LZFeMT33VaaU0X2IvaCBdV9P\nuHZjwgx1ffdXdbHYh6atoNjW3iBnwlKDpzL/XL7xW0DjuaEKSkqWhCpKo2LN\nxyFbK42/KUqLj//cD3EwhcFF2rgttbPA1S4gHUtnzX/jKgb0RMejVT3cy9qW\n0lxuhRv1XPv/cqcNDzO58g0y1ZmnUi4xR7hylnyX/OxMcrmjqmp11ZSKP0BF\npCtJIO6zWksFRymiujgNwKcKmXWzYHuJx/pwkMzApC7Gi+GqhsZoMgzlPATK\npHr9QqpYUnfBSLk+gd74S4PryHBy7dOR3F6wF53uBTzcm3vLtvFZK2GztLes\nBNyk9uWJ8MMv6TQwsG2nFr4CplmXAhN9QxxIDumjjmtAfRdihTwu+68MsWLd\nBELlH3ba3P1uhrJIzkEYPJJ87zHueXobt7Q4r+v8zBy5Oqz58hcNf5VdoT4n\nd3BJpa8b+HdlL7U6SUfp53/ViNcAa6f5l5Q/CWIHivceX3RQrlmPshU3ZO/N\nuNihycGAL/2cfkRrTHcEzjLd4QZ0NlgnKxsFzydJk+gwS++2pKyNdoRMWjbE\nu0M8Q4PoZ2DXzOt4cdV0+ahktOqAVCqzLPlj9qAJDPNXMgvM3u5XqVDWix/s\nbDHL\r\n=IA+Y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCfW2yhjw9gDc5DpWjEAcPi8ZxeBaiWxVaJug8JMORnfwIgFBUaPgs2FgtE6FGylbrDCqe71SnAtMDc1iPB9/Ws6bA="}],"size":66993,"noattachment":false,"key":"/ip-cidr/-/ip-cidr-2.0.15.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.15_1594885148031_0.2445545023081519"},"_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":1594885148127,"_cnpm_publish_time":1594885148127,"dist-tags":{"latest":"4.0.2"}}