Newton's Preposterous Miscalculation
Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

addr-to-ip-port

1.5.1 • Public • Published

addr-to-ip-port travis npm downloads javascript style guide

Convert an "address:port" string to an array [address:string, port:number]

Uses a cache to prevent excessive array allocations and GC.

Works in node and the browser. This module is used by WebTorrent!

install

npm install addr-to-ip-port

usage

const addrToIPPort = require('addr-to-ip-port')
 
addrToIPPort('1.2.3.4:8000') //=> ['1.2.3.4', 8000]
addrToIPPort('1.2.3.4:8000') //=> ['1.2.3.4', 8000] (returns the cached object)

license

MIT. Copyright (c) Feross Aboukhadijeh and WebTorrent, LLC.

Install

npm i addr-to-ip-port

DownloadsWeekly Downloads

4,282

Version

1.5.1

License

MIT

Unpacked Size

3.91 kB

Total Files

4

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar
  • avatar