Socket
Socket
Sign inDemoInstall

ip-bigint

Package Overview
Dependencies
0
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.1 to 7.0.0

6

index.js
export const max4 = 2n ** 32n - 1n;
export const max6 = 2n ** 128n - 1n;
const emptyPartsRe = /\b:?(?:0+:?){2,}/;
const emptyPartsRe = /\b:?(?:0+:?)+/;
const isIP = ip => ip.includes(":") ? 6 : ip.includes(".") ? 4 : 0;

@@ -103,1 +103,5 @@

}
export function normalizeIp(ip) {
return stringifyIp(parseIp(ip));
}

14

package.json
{
"name": "ip-bigint",
"version": "6.0.1",
"version": "7.0.0",
"description": "Convert IPv4 and IPv6 addresses to native BigInt and vice-versa",

@@ -15,11 +15,11 @@ "author": "silverwind <me@silverwind.io>",

"files": [
"index.js"
"./index.js"
],
"devDependencies": {
"eslint": "8.39.0",
"eslint-config-silverwind": "66.0.0",
"updates": "14.1.0",
"versions": "11.0.0",
"vitest": "0.30.1"
"eslint": "8.41.0",
"eslint-config-silverwind": "73.0.0",
"updates": "14.1.1",
"versions": "11.0.1",
"vitest": "0.31.2"
}
}

@@ -6,17 +6,16 @@ # ip-bigint

## Install
## Usage
```
npm i ip-bigint
```
## Example
```js
import {parseIp, stringifyIp} from "ip-bigint";
import {parseIp, stringifyIp, normalizeIp} from "ip-bigint";
const {number, version} = parseIp("2001:db8::");
parseIp("2001:db8::");
// => {number: 42540766411282592856903984951653826560n, version: 6}
const ip = stringifyIp({number, version});
stringifyIp({number, version});
// => "2001:db8::"
normalizeIp("2001:db8::0:0:1")
// => "2001:db8::1"
```

@@ -39,2 +38,6 @@

### normalizeIp(ip)
Round-trip an IP address through `parseIp` and `stringifyIp`, effectively normalizing its representation.
### Constants

@@ -41,0 +44,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc