addr-to-ip-port

2.0.0 • Public • Published

addr-to-ip-port ci 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

import addrToIPPort from '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.

Dependencies (0)

    Dev Dependencies (4)

    Package Sidebar

    Install

    npm i addr-to-ip-port

    Weekly Downloads

    3,448

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    5.93 kB

    Total Files

    5

    Last publish

    Collaborators

    • alxhotel
    • feross
    • mafintosh
    • flet
    • watson
    • diegorbaquero
    • hicom150
    • jhiesey
    • webtorrent-bot