0.0.3 • Published 7 months ago

@substrate-system/is-ip v0.0.3

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
7 months ago

is ip

tests types module semantic versioning Common Changelog install size dependencies license

Check if a string is an IP address.

Like Node's net.isIP function, but in userland.

See the docs

install

npm i -S @substrate-system/is-ip

Formats

This exposes ESM and common JS via package.json exports field.

ESM

import { isIP } from '@substrate-system/is-ip'

Common JS

const isIP = require('@substrate-system/is-ip')

pre-built JS

This package exposes minified JS files too. Copy them to a location that is accessible to your web server, then link to them in HTML.

copy

cp ./node_modules/@namespace/package/dist/module.min.js ./public

HTML

<script type="module" src="./module.min.js"></script>

Example

Return either 0, 4, or 6 depending on the type of IP address.

import { isIP } from '@substrate-system/is-ip'

isIP('::1')  // returns 6
isIP('127.0.0.1')  // returns 4
isIP('127.000.000.001')  // returns 0
isIP('127.0.0.1/24')  // returns 0
isIP('fhqwhgads')  // returns 0
0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago

0.0.0

7 months ago