{"id":13526660,"url":"https://github.com/sindresorhus/is-ip","last_synced_at":"2025-04-13T02:08:12.902Z","repository":{"id":20456321,"uuid":"23733517","full_name":"sindresorhus/is-ip","owner":"sindresorhus","description":"Check if a string is an IP address","archived":false,"fork":false,"pushed_at":"2023-08-05T13:42:06.000Z","size":19,"stargazers_count":113,"open_issues_count":1,"forks_count":15,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T03:07:42.373Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sindresorhus.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/security.md","support":null,"governance":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2014-09-06T11:52:15.000Z","updated_at":"2025-03-11T18:43:06.000Z","dependencies_parsed_at":"2023-09-27T10:37:29.630Z","dependency_job_id":null,"html_url":"https://github.com/sindresorhus/is-ip","commit_stats":{"total_commits":24,"total_committers":5,"mean_commits":4.8,"dds":"0.16666666666666663","last_synced_commit":"b8bc7acdf905168195d9e6892f9abbd65763fabd"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fis-ip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fis-ip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fis-ip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fis-ip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/is-ip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246759500,"owners_count":20829109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:32.835Z","updated_at":"2025-04-04T04:09:01.569Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["Repository"],"sub_categories":["Check/Detect"],"readme":"# is-ip\n\n\u003e Check if a string is an IP address\n\nIf you only need this for Node.js and don't care about browser support, you may want to use [`net.isIP`](https://nodejs.org/api/net.html#net_net_isip_input) instead. Note that it returns an integer instead of a boolean.\n\n## Install\n\n```sh\nnpm install is-ip\n```\n\n## Usage\n\n```js\nimport {isIP, isIPv4} from 'is-ip';\n\nisIP('1:2:3:4:5:6:7:8');\n//=\u003e true\n\nisIP('192.168.0.1');\n//=\u003e true\n\nisIPv4('1:2:3:4:5:6:7:8');\n//=\u003e false\n```\n\n## API\n\n### isIP(string)\n\nCheck if `string` is IPv6 or IPv4.\n\n### isIPv6(string)\n\nCheck if `string` is IPv6.\n\n### isIPv4(string)\n\nCheck if `string` is IPv4.\n\n### ipVersion(string)\n\nReturns `6` if `string` is IPv6, `4` if `string` is IPv4, or `undefined` if `string` is neither.\n\n```js\nimport {ipVersion} from 'is-ip';\n\nipVersion('1:2:3:4:5:6:7:8');\n//=\u003e 6\n\nipVersion('192.168.0.1');\n//=\u003e 4\n\nipVersion('abc');\n//=\u003e undefined\n```\n\n## Related\n\n- [ip-regex](https://github.com/sindresorhus/ip-regex) - Regular expression for matching IP addresses\n- [is-cidr](https://github.com/silverwind/is-cidr) - Check if a string is an IP address in CIDR notation\n- [cidr-regex](https://github.com/silverwind/cidr-regex) - Regular expression for matching IP addresses in CIDR notation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fis-ip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fis-ip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fis-ip/lists"}