@maboiteaspam/get-bind

1.0.1 • Public • Published

get-bind

get bind address. The friend of get-port to get a bind address, not only a port number.

Install

npm i @maboiteaspam/get-bind --save-dev

Usage

require('./index')(8888, 'localhost')
  .then(console.log)
  .catch(console.error) // print localhost:8888

require('./index')(false, 'localhost')
  .then(console.log)
  .catch(console.error) // print localhost:[random]

require('./index')(false)
  .then(console.log)
  .catch(console.error) // print 0.0.0.0:[random]

require('./index')()
  .then(console.log)
  .catch(console.error) // print 0.0.0.0:[random]

require('./index')('some.other:6666', 'localhost')
  .then(console.log)
  .catch(console.error) // print some.other:6666

require('./index')('some.other', 'localhost')
  .then(console.log)
  .catch(console.error) // print localhost:some.other // this is buggy, to be improved later

require('./index')(':80', 'localhost')
  .then(console.log)
  .catch(console.error) // print localhost::80 // this is buggy too, to be improved later

Read More

Readme

Keywords

Package Sidebar

Install

npm i @maboiteaspam/get-bind

Weekly Downloads

2

Version

1.0.1

License

WTF

Last publish

Collaborators

  • maboiteaspam