{"_id":"@chainsafe/is-ip","_rev":"4575349","name":"@chainsafe/is-ip","description":"Check if a string is an IP address","dist-tags":{"latest":"2.1.0"},"maintainers":[{"name":"philknows","email":""},{"name":"wemeetagain","email":""}],"time":{"modified":"2026-04-10T15:40:44.000Z","created":"2022-10-29T03:13:51.205Z","2.1.0":"2025-01-30T16:22:44.041Z","2.0.2":"2023-08-11T11:43:04.367Z","2.0.1":"2022-10-29T16:41:08.967Z","2.0.0":"2022-10-29T16:01:43.588Z","1.0.0":"2022-10-29T03:13:51.205Z"},"users":{},"author":{"name":"ChainSafe Systems"},"repository":{"type":"git","url":"git+https://github.com/ChainSafe/is-ip.git"},"versions":{"2.1.0":{"name":"@chainsafe/is-ip","version":"2.1.0","description":"Check if a string is an IP address","type":"module","exports":{".":{"node":"./lib/is-ip.node.js","import":"./lib/is-ip.js"},"./parse":{"import":"./lib/parse.js"},"./parser":{"import":"./lib/parser.js"}},"typesVersions":{"*":{"*":["*","lib/*","lib/*/index"]}},"types":"./lib/is-ip.d.ts","scripts":{"check-types":"tsc --noEmit","bench":"ts-node-esm ./node_modules/.bin/benchmark bench/**/*.test.ts","build":"tsc -p tsconfig.build.json","prepublishOnly":"yarn build","lint":"eslint --color --ext .ts src/ test/ bench/","test":"mocha test/**/*.test.ts","test:chrome":"playwright-test --runner mocha test/**/*.test.ts"},"pre-push":["lint"],"repository":{"type":"git","url":"git+https://github.com/ChainSafe/is-ip.git"},"keywords":["ip","ipv6","ipv4","regex","regexp","match","test","find","text","pattern","internet","protocol","address","validate","detect","check","is","string"],"author":{"name":"ChainSafe Systems"},"license":"MIT","bugs":{"url":"https://github.com/ChainSafe/is-ip/issues"},"homepage":"https://github.com/ChainSafe/is-ip#readme","devDependencies":{"@chainsafe/eslint-plugin-node":"^11.2.3","@dapplion/benchmark":"^0.2.2","@types/chai":"^4.2.0","@types/eslint":"^6.1.3","@types/mocha":"^8.0.3","@types/node":"^18.11.7","@typescript-eslint/eslint-plugin":"^5.27.1","@typescript-eslint/parser":"^5.27.1","chai":"^4.3.6","eslint":"^8.17.0","eslint-plugin-prettier":"^4.0.0","is-ip":"^5.0.0","karma":"^4.3.0","mocha":"^10.0.0","nyc":"^14.1.1","playwright-test":"^12.1.1","prettier":"^2.6.2","ts-node":"^10.8.1","typescript":"^4.7.3"},"licenseText":"Copyright © 2022 ChainSafe Systems\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@chainsafe/is-ip@2.1.0","dist":{"shasum":"ba9ac32acd9027698e0b56b91c7af069d28d7931","size":9287,"noattachment":false,"key":"/@chainsafe/is-ip/-/@chainsafe/is-ip-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@chainsafe/is-ip/download/@chainsafe/is-ip-2.1.0.tgz"},"_npmUser":{"name":"wemeetagain","email":"caymannava@gmail.com"},"directories":{},"maintainers":[{"name":"philknows","email":""},{"name":"wemeetagain","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/is-ip_2.1.0_1738254163775_0.731748078094647"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-01-30T16:22:44.041Z","publish_time":1738254164041,"_source_registry_name":"default","_cnpm_publish_time":1738254164041},"2.0.2":{"name":"@chainsafe/is-ip","version":"2.0.2","description":"Check if a string is an IP address","type":"module","exports":{".":{"node":"./lib/is-ip.node.js","import":"./lib/is-ip.js"},"./parse":{"import":"./lib/parse.js"},"./parser":{"import":"./lib/parser.js"}},"typesVersions":{"*":{"*":["*","lib/*","lib/*/index"]}},"types":"./lib/is-ip.d.ts","scripts":{"check-types":"tsc --noEmit","bench":"ts-node-esm ./node_modules/.bin/benchmark bench/**/*.test.ts","build":"tsc -p tsconfig.build.json","prepublishOnly":"yarn build","lint":"eslint --color --ext .ts src/ test/ bench/","test":"mocha test/**/*.test.ts","test:chrome":"playwright-test --runner mocha test/**/*.test.ts"},"pre-push":["lint"],"repository":{"type":"git","url":"git+https://github.com/ChainSafe/is-ip.git"},"keywords":["ip","ipv6","ipv4","regex","regexp","match","test","find","text","pattern","internet","protocol","address","validate","detect","check","is","string"],"author":{"name":"ChainSafe Systems"},"license":"MIT","bugs":{"url":"https://github.com/ChainSafe/is-ip/issues"},"homepage":"https://github.com/ChainSafe/is-ip#readme","devDependencies":{"@chainsafe/eslint-plugin-node":"^11.2.3","@dapplion/benchmark":"^0.2.2","@types/chai":"^4.2.0","@types/eslint":"^6.1.3","@types/mocha":"^8.0.3","@types/node":"^18.11.7","@typescript-eslint/eslint-plugin":"^5.27.1","@typescript-eslint/parser":"^5.27.1","chai":"^4.3.6","eslint":"^8.17.0","eslint-plugin-prettier":"^4.0.0","is-ip":"^5.0.0","karma":"^4.3.0","mocha":"^10.0.0","nyc":"^14.1.1","playwright-test":"^12.1.1","prettier":"^2.6.2","ts-node":"^10.8.1","typescript":"^4.7.3"},"licenseText":"Copyright © 2022 ChainSafe Systems\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@chainsafe/is-ip@2.0.2","dist":{"shasum":"7311e7403f11d8c5cfa48111f56fcecaac37c9f6","size":7550,"noattachment":false,"key":"/@chainsafe/is-ip/-/@chainsafe/is-ip-2.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@chainsafe/is-ip/download/@chainsafe/is-ip-2.0.2.tgz"},"_npmUser":{"name":"wemeetagain","email":"caymannava@gmail.com"},"directories":{},"maintainers":[{"name":"philknows","email":""},{"name":"wemeetagain","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-ip_2.0.2_1691754184221_0.3296117720009164"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-08-11T11:43:04.367Z","publish_time":1691754184367,"_source_registry_name":"default","_cnpm_publish_time":1691754184367},"2.0.1":{"name":"@chainsafe/is-ip","version":"2.0.1","description":"Check if a string is an IP address","type":"module","exports":{".":{"node":"./lib/is-ip.node.js","import":"./lib/is-ip.js"},"./parse":{"import":"./lib/parse.js"},"./parser":{"import":"./lib/parser.js"}},"typesVersions":{"*":{"*":["*","lib/*","lib/*/index"]}},"types":"./lib/is-ip.d.ts","scripts":{"check-types":"tsc --noEmit","bench":"ts-node-esm ./node_modules/.bin/benchmark bench/**/*.test.ts","build":"tsc -p tsconfig.build.json","prepublishOnly":"yarn build","lint":"eslint --color --ext .ts src/ test/ bench/","test":"mocha test/**/*.test.ts"},"pre-push":["lint"],"repository":{"type":"git","url":"git+https://github.com/ChainSafe/is-ip.git"},"keywords":["ip","ipv6","ipv4","regex","regexp","match","test","find","text","pattern","internet","protocol","address","validate","detect","check","is","string"],"author":{"name":"ChainSafe Systems"},"license":"MIT","bugs":{"url":"https://github.com/ChainSafe/is-ip/issues"},"homepage":"https://github.com/ChainSafe/is-ip#readme","devDependencies":{"@chainsafe/eslint-plugin-node":"^11.2.3","@dapplion/benchmark":"^0.2.2","@types/chai":"^4.2.0","@types/eslint":"^6.1.3","@types/mocha":"^8.0.3","@types/node":"^18.11.7","@typescript-eslint/eslint-plugin":"^5.27.1","@typescript-eslint/parser":"^5.27.1","chai":"^4.3.6","eslint":"^8.17.0","eslint-plugin-prettier":"^4.0.0","is-ip":"^5.0.0","karma":"^4.3.0","mocha":"^10.0.0","nyc":"^14.1.1","prettier":"^2.6.2","ts-node":"^10.8.1","typescript":"^4.7.3"},"dependencies":{},"licenseText":"Copyright © 2022 ChainSafe Systems\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@chainsafe/is-ip@2.0.1","dist":{"shasum":"62cb285669d91f88fd9fa285048dde3882f0993b","size":7336,"noattachment":false,"key":"/@chainsafe/is-ip/-/@chainsafe/is-ip-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@chainsafe/is-ip/download/@chainsafe/is-ip-2.0.1.tgz"},"_npmUser":{"name":"wemeetagain","email":"caymannava@gmail.com"},"directories":{},"maintainers":[{"name":"philknows","email":""},{"name":"wemeetagain","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-ip_2.0.1_1667061668747_0.9122098877060578"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-29T16:41:13.927Z","publish_time":1667061668967,"_cnpm_publish_time":1667061668967},"2.0.0":{"name":"@chainsafe/is-ip","version":"2.0.0","description":"Check if a string is an IP address","type":"module","exports":{".":{"node":"./lib/is-ip.node.js","import":"./lib/is-ip.js"},"./parse":{"import":"./lib/parse.js"},"./parser":{"import":"./lib/parser.js"}},"typesVersions":{"*":{"*":["*","lib/*","lib/*/index"]}},"types":"./lib/is-ip.d.ts","scripts":{"check-types":"tsc --noEmit","bench":"ts-node-esm ./node_modules/.bin/benchmark bench/**/*.test.ts","build":"tsc -p tsconfig.build.json","prepublishOnly":"yarn build","lint":"eslint --color --ext .ts src/ test/ bench/","test":"mocha test/**/*.test.ts"},"pre-push":["lint"],"repository":{"type":"git","url":"git+https://github.com/ChainSafe/is-ip.git"},"keywords":["ip","ipv6","ipv4","regex","regexp","match","test","find","text","pattern","internet","protocol","address","validate","detect","check","is","string"],"author":{"name":"ChainSafe Systems"},"license":"MIT","bugs":{"url":"https://github.com/ChainSafe/is-ip/issues"},"homepage":"https://github.com/ChainSafe/is-ip#readme","devDependencies":{"@chainsafe/eslint-plugin-node":"^11.2.3","@dapplion/benchmark":"^0.2.2","@types/chai":"^4.2.0","@types/eslint":"^6.1.3","@types/mocha":"^8.0.3","@types/node":"^18.11.7","@typescript-eslint/eslint-plugin":"^5.27.1","@typescript-eslint/parser":"^5.27.1","chai":"^4.3.6","eslint":"^8.17.0","eslint-plugin-prettier":"^4.0.0","is-ip":"^5.0.0","karma":"^4.3.0","mocha":"^10.0.0","nyc":"^14.1.1","prettier":"^2.6.2","ts-node":"^10.8.1","typescript":"^4.7.3"},"dependencies":{},"gitHead":"f9a2f30db7f48cb2f672cf751c3dc82c166bf921","_id":"@chainsafe/is-ip@2.0.0","_nodeVersion":"16.15.0","_npmVersion":"8.10.0","dist":{"shasum":"e1f31ed28c5196ee72f69841e3a97c7bfb2506e4","size":7249,"noattachment":false,"key":"/@chainsafe/is-ip/-/@chainsafe/is-ip-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@chainsafe/is-ip/download/@chainsafe/is-ip-2.0.0.tgz"},"_npmUser":{"name":"wemeetagain","email":"caymannava@gmail.com"},"directories":{},"maintainers":[{"name":"philknows","email":""},{"name":"wemeetagain","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-ip_2.0.0_1667059303434_0.7780699068977666"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-29T16:01:48.859Z","publish_time":1667059303588,"_cnpm_publish_time":1667059303588},"1.0.0":{"name":"@chainsafe/is-ip","version":"1.0.0","description":"Check if a string is an IP address","type":"module","exports":{".":{"import":"./lib/index.js"},"./parser":{"import":"./lib/parser.js"}},"typesVersions":{"*":{"*":["*","lib/*","lib/*/index"]}},"types":"./lib/index.d.ts","scripts":{"check-types":"tsc --noEmit","bench":"ts-node-esm ./node_modules/.bin/benchmark bench/**/*.test.ts","build":"tsc -p tsconfig.build.json","prepublishOnly":"yarn build","lint":"eslint --color --ext .ts src/ test/ bench/","test":"mocha test/**/*.test.ts"},"pre-push":["lint"],"repository":{"type":"git","url":"git+https://github.com/ChainSafe/is-ip.git"},"keywords":["ip","ipv6","ipv4","regex","regexp","match","test","find","text","pattern","internet","protocol","address","validate","detect","check","is","string"],"author":{"name":"ChainSafe Systems"},"license":"MIT","bugs":{"url":"https://github.com/ChainSafe/is-ip/issues"},"homepage":"https://github.com/ChainSafe/is-ip#readme","devDependencies":{"@chainsafe/eslint-plugin-node":"^11.2.3","@dapplion/benchmark":"^0.2.2","@types/chai":"^4.2.0","@types/eslint":"^6.1.3","@types/mocha":"^8.0.3","@types/node":"^18.11.7","@typescript-eslint/eslint-plugin":"^5.27.1","@typescript-eslint/parser":"^5.27.1","chai":"^4.3.6","eslint":"^8.17.0","eslint-plugin-prettier":"^4.0.0","is-ip":"^5.0.0","karma":"^4.3.0","mocha":"^10.0.0","nyc":"^14.1.1","prettier":"^2.6.2","ts-node":"^10.8.1","typescript":"^4.7.3"},"dependencies":{},"gitHead":"65211d9c352fbbb663f03ab917a97ef046f54381","_id":"@chainsafe/is-ip@1.0.0","_nodeVersion":"16.15.0","_npmVersion":"8.10.0","dist":{"shasum":"70ff63a042db4d3576514194f20adf478128ca02","size":6574,"noattachment":false,"key":"/@chainsafe/is-ip/-/@chainsafe/is-ip-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@chainsafe/is-ip/download/@chainsafe/is-ip-1.0.0.tgz"},"_npmUser":{"name":"wemeetagain","email":"caymannava@gmail.com"},"directories":{},"maintainers":[{"name":"philknows","email":""},{"name":"wemeetagain","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-ip_1.0.0_1667013230987_0.5484534262605525"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-29T03:13:56.144Z","publish_time":1667013231205,"_cnpm_publish_time":1667013231205}},"readme":"# @chainsafe/is-ip\n\n> Check if a string is an IP address\n\n## Install\n\n```bash\nnpm install @chainsafe/is-ip\n```\n\n## Example\n\nCheck if a string is an IP address\n\n```typescript\nimport { expect } from \"chai\";\nimport {\n\tisIPv4,\n\tisIPv6,\n\tisIP,\n\tipVersion,\n} from \"@chainsafe/is-ip\";\n\n// check if a string is a valid IPv4\nexpect(isIPv4(\"127.0.0.1\")).to.equal(true);\n\n// check if a string is a valid IPv6\nexpect(isIPv6(\"127.0.0.1\")).to.equal(false);\n\n// check if a string is a valid IPv4 or IPv6\nexpect(isIP(\"127.0.0.1\")).to.equal(true);\n\n// return 4, 6, or undefined\nexpect(ipVersion(\"127.0.0.1\")).to.equal(4);\nexpect(ipVersion(\"1:2:3:4:5:6:7:8\")).to.equal(6);\nexpect(ipVersion(\"invalid ip\")).to.equal(undefined);\n```\n\nParse a string into IP address bytes\n\n```typescript\nimport { expect } from \"chai\";\nimport {\n\tparseIPv4,\n\tparseIPv4Mapped,\n\tparseIPv6,\n\tparseIP,\n} from \"@chainsafe/is-ip/parse\";\n\n// parse a string into IPv4 bytes\nconst b1 = parseIPv4(\"127.0.0.1\");\nexpect(b1).to.deep.equal(Uint8Array.from([127, 0, 0, 1]));\n\n// parse a string into IPv6 bytes\nconst b2 = parseIPv6(\"::1\");\nexpect(b2).to.deep.equal(Uint8Array.from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]));\n\n// parse an IPv4 string into IPv4-mapped IPv6 bytes\nconst b3 = parseIPv4Mapped(\"127.0.0.1\");\nexpect(b3).to.deep.equal(Uint8Array.from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 0, 1]));\n\n// parse a string into either IPv4 or IPv6 bytes\nconst b4 = parseIP(\"127.0.0.1\");\nexpect(b4).to.deep.equal(Uint8Array.from([127, 0, 0, 1]));\n\nconst b5 = parseIP(\"::1\");\nexpect(b5).to.deep.equal(Uint8Array.from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]));\n\nconst b6 = parseIP(\"127.0.0.1\", true);\nexpect(b6).to.deep.equal(Uint8Array.from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 0, 1]));\n\n// parseIP* functions return undefined on invalid input\nexpect(parseIP(\"not an IP\")).to.equal(undefined);\n```\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/ChainSafe/is-ip#readme","bugs":{"url":"https://github.com/ChainSafe/is-ip/issues"},"license":"MIT"}