0.5.0 • Published 6 years ago

ipv4-address v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

ipv4-address NPM version Build Status Dependency Status Coverage percentage

A single IPv4 address

Installation

$ npm install --save ipv4-address

Usage

import toIPv4Address from "ipv4-address";
const toIPv4Address = require("ipv4-address");

toIPv4Address([127, 0, 0, 1]); // [0, 0, 0, 0]
toIPv4Address("255.256.300.3000"); // [255, 255, 255, 255]
toIPv4Address("0.0.0.0"); // [0, 0, 0, 0]
toIPv4Address("127.0.0.1").toString(); // "127.0.0.1"
toIPv4Address("0.0.0"); // Throws an error (not long enough)
toIPv4Address("0.0.0.0.0"); // Throws an error (too long)
import IPv4Address from "ipv4-address/IPv4Address"; // Extends Uint8Array
const IPv4Address = require("ipv4-address/IPv4Address"); // Extends Uint8Array

new IPv4Address([0, 0, 0, 0]); // [0, 0, 0, 0]
IPv4Address.parse("127.0.0.1"); // [127, 0, 0, 0]
IPv4Address.from([127, 0, 0, 1]); // [127, 0, 0, 0]
IPv4Address.of(127, 0, 0, 1); // [127, 0, 0, 0]
new IPv4Address([0, 0, 0]); // Throws an error (not long enough)
new IPv4Address([0, 0, 0, 0, 0]); // Throws an error (too long)

License

MIT © Malte-Maurice Dreyer

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

9 years ago

0.2.0

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.0

9 years ago