{"_id":"@se-oss/ip-address","_rev":"4-539028c6703241b2a352c24960f13206","name":"@se-oss/ip-address","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@se-oss/ip-address","version":"1.0.0","keywords":["ip","ipv4","ipv6","cidr","address","network","subnet","parser","validator","typescript","javascript"],"author":{"url":"https://github.com/shahradelahi","name":"Shahrad Elahi","email":"shahrad@litehex.com"},"license":"MIT","_id":"@se-oss/ip-address@1.0.0","maintainers":[{"name":"shahradelahi","email":"shahrad@litehex.com"}],"homepage":"https://github.com/shahradelahi/ip-address","bugs":{"url":"https://github.com/shahradelahi/ip-address/issues"},"dist":{"shasum":"eba1f72d812d9cc21b23077566f43f01fe98928d","tarball":"https://registry.npmjs.org/@se-oss/ip-address/-/ip-address-1.0.0.tgz","fileCount":6,"integrity":"sha512-J8fNccaM/Wcynk18cd22NimIi+Dn6777sqzx0HWkuPuMgQUVWT274k4ktChNboMAyN78HxaD5sWJkanEZi5Mqw==","signatures":[{"sig":"MEUCIGz2FoMzTv/vETaEo432om6GKZL03/xBfpPF9vlnAcFDAiEA1HomUqFPTYyjXCk4llZxi8uSrAfDe+zx487v0IS5rvw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@se-oss%2fip-address@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":73617},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","default":"./dist/index.cjs"}},"gitHead":"9f44ac4549dde5e15621366cc5511ced097528b4","scripts":{"dev":"tsup --watch","lint":"pnpm typecheck && eslint .","test":"vitest --run","bench":"vitest bench --run","build":"pnpm typecheck && tsup","clean":"git clean -dfx node_modules dist .tsbuildinfo","format":"prettier --write .","lint:fix":"eslint --fix .","typecheck":"tsc --noEmit","format:check":"prettier --check .","prepublishOnly":"pnpm build && pnpm lint && pnpm format:check && pnpm test"},"_npmUser":{"name":"shahradelahi","email":"shahrad@litehex.com"},"prettier":"@shahrad/prettier-config","repository":{"url":"git+https://github.com/shahradelahi/ip-address.git","type":"git"},"_npmVersion":"10.9.3","description":"A modern, immutable, and zero-dependency library for working with IPv4 and IPv6 addresses in JavaScript and TypeScript.","directories":{},"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"packageManager":"pnpm@10.15.0","devDependencies":{"tsx":"^4.20.6","tsup":"^8.5.0","eslint":"^9.37.0","vitest":"^3.2.4","globals":"^16.4.0","prettier":"^3.6.2","typescript":"^5.9.3","@types/node":"^24.7.0","@shahrad/tsconfig":"^1.2.0","@shahrad/eslint-config":"^1.0.1","@shahrad/prettier-config":"^1.2.2"},"_npmOperationalInternal":{"tmp":"tmp/ip-address_1.0.0_1759918162834_0.43844667405222215","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@se-oss/ip-address","version":"1.0.1","keywords":["ip","ipv4","ipv6","cidr","address","network","subnet","parser","validator","typescript","javascript"],"author":{"url":"https://github.com/shahradelahi","name":"Shahrad Elahi","email":"shahrad@litehex.com"},"license":"MIT","_id":"@se-oss/ip-address@1.0.1","maintainers":[{"name":"shahradelahi","email":"shahrad@litehex.com"}],"homepage":"https://github.com/shahradelahi/ip-address","bugs":{"url":"https://github.com/shahradelahi/ip-address/issues"},"dist":{"shasum":"e3f835c450db8500ace325a77b01497522c55b72","tarball":"https://registry.npmjs.org/@se-oss/ip-address/-/ip-address-1.0.1.tgz","fileCount":6,"integrity":"sha512-CJuSIfC06mR0YXg4s5nQcGe5UQwcxz98YrJFGZcC5a/8oK2nMrUWtxCwGX0HJeyDdroxxdrtovtpEZM2rTfExQ==","signatures":[{"sig":"MEUCIQD93dTYyqtyuxV4ZD49e6IgpS+P8sFS6GAkYXYeSF0DCwIgExfG9PiI+ewxhSyMp5yG1dchT0Vj9MNTWHIwedE/TcE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@se-oss%2fip-address@1.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":73665},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","default":"./dist/index.cjs"}},"gitHead":"eebe8ce321ff23a3c7979c2ce436bf7a4016149c","scripts":{"dev":"tsup --watch","lint":"pnpm typecheck && eslint .","test":"vitest --run","bench":"vitest bench --run","build":"pnpm typecheck && tsup","clean":"git clean -dfx node_modules dist .tsbuildinfo","format":"prettier --write .","lint:fix":"eslint --fix .","typecheck":"tsc --noEmit","format:check":"prettier --check .","prepublishOnly":"pnpm build && pnpm lint && pnpm format:check && pnpm test"},"_npmUser":{"name":"shahradelahi","email":"shahrad@litehex.com"},"prettier":"@shahrad/prettier-config","repository":{"url":"git+https://github.com/shahradelahi/ip-address.git","type":"git"},"_npmVersion":"10.9.3","description":"A modern, immutable, and zero-dependency library for working with IPv4 and IPv6 addresses in JavaScript and TypeScript.","directories":{},"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"packageManager":"pnpm@10.15.0","devDependencies":{"tsx":"^4.20.6","tsup":"^8.5.0","eslint":"^9.37.0","vitest":"^3.2.4","globals":"^16.4.0","prettier":"^3.6.2","typescript":"^5.9.3","@types/node":"^24.7.0","@shahrad/tsconfig":"^1.2.0","@shahrad/eslint-config":"^1.0.1","@shahrad/prettier-config":"^1.2.2"},"_npmOperationalInternal":{"tmp":"tmp/ip-address_1.0.1_1759920222882_0.3094290403537745","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@se-oss/ip-address","version":"1.1.0","keywords":["ip","ipv4","ipv6","cidr","address","network","subnet","parser","validator","typescript","javascript"],"author":{"url":"https://github.com/shahradelahi","name":"Shahrad Elahi","email":"shahrad@litehex.com"},"license":"MIT","_id":"@se-oss/ip-address@1.1.0","maintainers":[{"name":"shahradelahi","email":"shahrad@litehex.com"}],"homepage":"https://github.com/shahradelahi/ip-address","bugs":{"url":"https://github.com/shahradelahi/ip-address/issues"},"dist":{"shasum":"d6a4605bc91039d1f5e4e1fdda963fdfcf3cff3a","tarball":"https://registry.npmjs.org/@se-oss/ip-address/-/ip-address-1.1.0.tgz","fileCount":6,"integrity":"sha512-nyADzEzJy8QjMk5o3fKe3AcNIKsTiOxdVNthGIwPYDVgo7c/tCV6AjoBulDTzZxSuybkvT357jl/OPj1Hylr2Q==","signatures":[{"sig":"MEYCIQCqhm+d1IKhy8FXCwpHMrYHBpxHbF/zMCObxsAlcpc8VQIhAKYF39Tytme6ZF2Wvz1D3zojzVR7/4PK8qa1mLVginni","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@se-oss%2fip-address@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":74234},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","default":"./dist/index.cjs"}},"gitHead":"0daecce45dd7f1a411620c83a64468cf1d210964","scripts":{"dev":"tsup --watch","lint":"pnpm typecheck && eslint .","test":"vitest --run","bench":"vitest bench --run","build":"pnpm typecheck && tsup","clean":"git clean -dfx node_modules dist .tsbuildinfo","format":"prettier --write .","lint:fix":"eslint --fix .","typecheck":"tsc --noEmit","format:check":"prettier --check .","prepublishOnly":"pnpm build && pnpm lint && pnpm format:check && pnpm test"},"_npmUser":{"name":"shahradelahi","email":"shahrad@litehex.com"},"prettier":"@shahrad/prettier-config","repository":{"url":"git+https://github.com/shahradelahi/ip-address.git","type":"git"},"_npmVersion":"10.9.3","description":"A modern, immutable, and zero-dependency library for working with IPv4 and IPv6 addresses in JavaScript and TypeScript.","directories":{},"_nodeVersion":"22.20.0","_hasShrinkwrap":false,"packageManager":"pnpm@10.15.0","devDependencies":{"tsx":"^4.20.6","tsup":"^8.5.0","eslint":"^9.37.0","vitest":"^3.2.4","globals":"^16.4.0","prettier":"^3.6.2","typescript":"^5.9.3","@types/node":"^24.7.0","@shahrad/tsconfig":"^1.2.0","@shahrad/eslint-config":"^1.0.1","@shahrad/prettier-config":"^1.2.2"},"_npmOperationalInternal":{"tmp":"tmp/ip-address_1.1.0_1760002650817_0.18758928862953028","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@se-oss/ip-address","version":"1.1.1","description":"A modern, immutable, and zero-dependency library for working with IPv4 and IPv6 addresses in JavaScript and TypeScript.","keywords":["ip","ipv4","ipv6","cidr","address","network","subnet","parser","validator","typescript","javascript"],"homepage":"https://github.com/shahradelahi/ip-address","repository":{"type":"git","url":"git+https://github.com/shahradelahi/ip-address.git"},"license":"MIT","author":{"name":"Shahrad Elahi","email":"shahrad@litehex.com","url":"https://github.com/shahradelahi"},"type":"module","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","prettier":"@shahrad/prettier-config","devDependencies":{"@changesets/cli":"^2.31.1","@shahrad/eslint-config":"^1.1.0","@shahrad/prettier-config":"^1.2.2","@shahrad/tsconfig":"^1.3.0","@types/node":"^26.1.2","eslint":"^10.8.0","globals":"^16.5.0","prettier":"^3.9.6","tsup":"^8.5.1","typescript":"^6.0.3","vitest":"^3.2.7"},"scripts":{"bench":"vitest bench --run","build":"tsup","ci:publish":"changeset publish","clean":"git clean -dfx node_modules dist .tsbuildinfo","dev":"tsup --watch","format":"prettier --write .","format:check":"prettier --check .","lint":"pnpm typecheck && eslint .","lint:fix":"eslint --fix .","test":"vitest --run","typecheck":"tsc --noEmit"},"_id":"@se-oss/ip-address@1.1.1","bugs":{"url":"https://github.com/shahradelahi/ip-address/issues"},"_integrity":"sha512-/pqgLSoPaoq2QQ6wHo12kwHdGTiYkzlsmyqUpjQ7zUUq3kaKifCqTkgWjCfCSdHbOE5JB01PFipwXZ+pY5Ny6Q==","_resolved":"/tmp/713abd73fb03101126bb4042c2485366/se-oss-ip-address-1.1.1.tgz","_from":"file:se-oss-ip-address-1.1.1.tgz","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-/pqgLSoPaoq2QQ6wHo12kwHdGTiYkzlsmyqUpjQ7zUUq3kaKifCqTkgWjCfCSdHbOE5JB01PFipwXZ+pY5Ny6Q==","shasum":"4174eb35ef6f48126702ec3131948893088b0e64","tarball":"https://registry.npmjs.org/@se-oss/ip-address/-/ip-address-1.1.1.tgz","fileCount":7,"unpackedSize":90115,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@se-oss%2fip-address@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAcmC+s4IQwCkkxONvvncZhPAbBs5zxf0n2xnHcu+b6CAiEA2D+9PVBYhQaeS4j6AXGig74cDhAqNN2E0PDtb65XsIk="}]},"_npmUser":{"name":"shahradelahi","email":"shahrad@litehex.com"},"directories":{},"maintainers":[{"name":"shahradelahi","email":"shahrad@litehex.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ip-address_1.1.1_1785782060127_0.8595917315982273"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-08T10:09:22.769Z","modified":"2026-08-03T18:34:20.651Z","1.0.0":"2025-10-08T10:09:23.022Z","1.0.1":"2025-10-08T10:43:43.106Z","1.1.0":"2025-10-09T09:37:30.994Z","1.1.1":"2026-08-03T18:34:20.270Z"},"bugs":{"url":"https://github.com/shahradelahi/ip-address/issues"},"author":{"name":"Shahrad Elahi","email":"shahrad@litehex.com","url":"https://github.com/shahradelahi"},"license":"MIT","homepage":"https://github.com/shahradelahi/ip-address","keywords":["ip","ipv4","ipv6","cidr","address","network","subnet","parser","validator","typescript","javascript"],"repository":{"type":"git","url":"git+https://github.com/shahradelahi/ip-address.git"},"description":"A modern, immutable, and zero-dependency library for working with IPv4 and IPv6 addresses in JavaScript and TypeScript.","maintainers":[{"name":"shahradelahi","email":"shahrad@litehex.com"}],"readme":"# @se-oss/ip-address\n\n[![CI](https://github.com/shahradelahi/ip-address/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/shahradelahi/ip-address/actions/workflows/ci.yml)\n[![NPM Version](https://img.shields.io/npm/v/@se-oss/ip-address.svg)](https://www.npmjs.com/package/@se-oss/ip-address)\n[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](/LICENSE)\n![npm bundle size](https://img.shields.io/bundlephobia/minzip/@se-oss/ip-address)\n[![Install Size](https://packagephobia.com/badge?p=@se-oss/ip-address)](https://packagephobia.com/result?p=@se-oss/ip-address)\n\n_@se-oss/ip-address_ is a modern, immutable, and zero-dependency library for working with IPv4 and IPv6 addresses in JavaScript and TypeScript.\n\n---\n\n- [Installation](#-installation)\n- [Usage](#-usage)\n- [Documentation](#-documentation)\n- [Contributing](#-contributing)\n- [License](#license)\n\n## 📦 Installation\n\n```bash\nnpm install @se-oss/ip-address\n```\n\n<details>\n<summary>Install using your favorite package manager</summary>\n\n**pnpm**\n\n```bash\npnpm install @se-oss/ip-address\n```\n\n**yarn**\n\n```bash\nyarn add @se-oss/ip-address\n```\n\n</details>\n\n## 📖 Usage\n\nThis library makes working with IP addresses a breeze. Here are a few common scenarios:\n\n### Parsing and Validation\n\nYou can easily parse any IP address string. The library will automatically figure out the version and throw an error if the address is invalid.\n\n```typescript\nimport { IPv4, IPv6, parseIP } from '@se-oss/ip-address';\n\n// Let the factory do the work\nconst ip = parseIP('192.168.1.1'); // Returns an IPv4 instance\nconst ip6 = parseIP('2001:db8::1'); // Returns an IPv6 instance\n\nconsole.log(ip.version); // 4\nconsole.log(ip6.version); // 6\n\n// Or validate without creating an instance\nif (IPv4.isValid('10.0.0.1')) {\n  console.log('Yep, a valid IPv4 address.');\n}\n\ntry {\n  parseIP('not.an.ip');\n} catch (error) {\n  console.error(error.message); // \"Invalid IP address: not.an.ip\"\n}\n```\n\n### Working with IPv4 Addresses\n\nOnce you have an `IPv4` instance, you can perform all sorts of checks and conversions.\n\n```typescript\nimport { IPv4 } from '@se-oss/ip-address';\n\nconst ip = new IPv4('192.168.1.1');\n\n// Check its type\nconsole.log(ip.isPrivate()); // true\nconsole.log(ip.isLoopback()); // false\n\n// Convert it\nconsole.log(ip.toBigInt()); // 3232235777n\nconsole.log(ip.toBytes()); // [192, 168, 1, 1]\nconsole.log(ip.toArpa()); // \"1.1.168.192.in-addr.arpa\"\n\n// Get the next IP\nconst nextIp = ip.next();\nconsole.log(nextIp.address); // \"192.168.1.2\"\n```\n\n### Working with IPv6 Addresses\n\nIPv6 is just as easy, with full support for its unique features.\n\n```typescript\nimport { IPv6 } from '@se-oss/ip-address';\n\nconst ip6 = new IPv6('2001:db8::8a2e:370:7334');\n\n// Get compressed vs. expanded address\nconsole.log(ip6.address); // \"2001:db8::8a2e:370:7334\"\nconsole.log(ip6.expandedAddress); // \"2001:0db8:0000:0000:0000:8a2e:0370:7334\"\n\n// Check its type\nconsole.log(ip6.isGlobalUnicast()); // true\nconsole.log(ip6.isLinkLocal()); // false\n\n// Handle IPv4-mapped addresses\nconst mappedIp = new IPv6('::ffff:192.168.1.1');\nconsole.log(mappedIp.isIPv4Mapped()); // true\nconst ipv4 = mappedIp.toIPv4();\nconsole.log(ipv4.address); // \"192.168.1.1\"\n```\n\n### Handling CIDR Blocks\n\nNeed to work with subnets? The `CIDR` class has you covered.\n\n```typescript\nimport { CIDR } from '@se-oss/ip-address';\n\nconst cidr = new CIDR('10.0.0.0/24');\n\n// Get network details\nconsole.log(cidr.network.address); // \"10.0.0.0\"\nconsole.log(cidr.broadcast.address); // \"10.0.0.255\"\nconsole.log(cidr.first.address); // \"10.0.0.1\"\nconsole.log(cidr.last.address); // \"10.0.0.254\"\n\n// Check if an IP falls within the range\nconsole.log(cidr.contains('10.0.0.123')); // true\nconsole.log(cidr.contains('10.0.1.1')); // false\n```\n\n## 📚 Documentation\n\nFor all configuration options, please see [the API docs](https://www.jsdocs.io/package/@se-oss/ip-address).\n\n## 🤝 Contributing\n\nWant to contribute? Awesome! To show your support is to star the project, or to raise issues on [GitHub](https://github.com/shahradelahi/ip-address)\n\nThanks again for your support, it is much appreciated! 🙏\n\n## License\n\n[MIT](/LICENSE) © [Shahrad Elahi](https://github.com/shahradelahi) and [contributors](https://github.com/shahradelahi/ip-address/graphs/contributors).\n","readmeFilename":"README.md"}