# sindresorhus/is-ip architecture

> Architecture diagram of the GitHub repository sindresorhus/is-ip, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sindresorhus/is-ip
- Repository: https://github.com/sindresorhus/is-ip

## Overview

is-ip is a small IP-address validation library. A caller supplies a string to a family-specific check or the combined check; the implementation builds an exact-match IP regex and tests it with a timeout. ipVersion delegates to the IPv6 and IPv4 checks and returns the matching version, or undefined. The runtime relationships are shown from index.js; no additional runtime subsystem is evident in the supplied tree.

Main entry points: [`index.js`](https://github.com/sindresorhus/is-ip/blob/main/index.js) (isIPv4)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Library caller"))
node_isip["isIP<br/>[index.js]"]
node_ipv4["isIPv4<br/>[index.js]"]
node_ipv6["isIPv6<br/>[index.js]"]
node_version["ipVersion<br/>[index.js]"]
node_ipregex["ip-regex"]
node_superregex["super-regex"]

node_caller -->|"checks address"| node_isip
node_caller -->|"checks IPv4"| node_ipv4
node_caller -->|"checks IPv6"| node_ipv6
node_caller -->|"gets version"| node_version
node_isip -->|"builds pattern"| node_ipregex
node_isip -->|"tests match"| node_superregex
node_ipv4 -->|"builds pattern"| node_ipregex
node_ipv4 -->|"tests match"| node_superregex
node_ipv6 -->|"builds pattern"| node_ipregex
node_ipv6 -->|"tests match"| node_superregex
node_version -->|"checks first"| node_ipv6
node_version -->|"checks second"| node_ipv4

click node_isip "https://github.com/sindresorhus/is-ip/blob/main/index.js"
click node_ipv4 "https://github.com/sindresorhus/is-ip/blob/main/index.js"
click node_ipv6 "https://github.com/sindresorhus/is-ip/blob/main/index.js"
click node_version "https://github.com/sindresorhus/is-ip/blob/main/index.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_caller,node_ipregex,node_superregex toneIndigo
class node_isip,node_ipv4,node_ipv6,node_version toneTeal
```

## Components

### Other components

- **Library caller**
- [isIP](https://github.com/sindresorhus/is-ip/blob/main/index.js): `index.js`
- [isIPv4](https://github.com/sindresorhus/is-ip/blob/main/index.js): `index.js`
- [isIPv6](https://github.com/sindresorhus/is-ip/blob/main/index.js): `index.js`
- [ipVersion](https://github.com/sindresorhus/is-ip/blob/main/index.js): `index.js`
- **ip-regex**
- **super-regex**

## Connections

- Library caller → isIP: checks address (evidence: `readme.md`)
- Library caller → isIPv4: checks IPv4 (evidence: `readme.md`)
- Library caller → isIPv6: checks IPv6 (evidence: `readme.md`)
- Library caller → ipVersion: gets version (evidence: `readme.md`)
- isIP → ip-regex: builds pattern (evidence: `index.js`)
- isIP → super-regex: tests match (evidence: `index.js`)
- isIPv4 → ip-regex: builds pattern (evidence: `index.js`)
- isIPv4 → super-regex: tests match (evidence: `index.js`)
- isIPv6 → ip-regex: builds pattern (evidence: `index.js`)
- isIPv6 → super-regex: tests match (evidence: `index.js`)
- ipVersion → isIPv6: checks first (evidence: `index.js`)
- ipVersion → isIPv4: checks second (evidence: `index.js`)
