Skip to content

Add support promise#26

Merged
scravy merged 1 commit intoscravy:masterfrom
Jungwoo-An:promise
Apr 21, 2020
Merged

Add support promise#26
scravy merged 1 commit intoscravy:masterfrom
Jungwoo-An:promise

Conversation

@Jungwoo-An
Copy link
Copy Markdown
Contributor

@Jungwoo-An Jungwoo-An commented Jul 1, 2019

Addresses #24

Sorry, too late.
one, all function support promise.

API

.one(iface, callback)  string
.one(callback)         string
.one()                 Promise<mac: string>

.all(callback)         { iface: { type: address } }
.all()                 Promise<Array<{ iface: { type: address } }>>

Example

const macaddress = require('macaddress');

macaddress.one().then(mac => console.log(mac));
// 00:00:00:00:00:00

macaddress.all().then(all => console.log(all));
/*
{
  "en0": {
    "ipv6": "fe80::cae0:ebff:fe14:1da9",
    "ipv4": "192.168.178.20",
    "mac": "ab:42:de:13:ef:37"
  },
  "awdl0": {
    "ipv6": "fe80::58b9:daff:fea9:23a9",
    "mac": "ab:cd:ef:34:12:56"
  }
}
*/

@Jungwoo-An Jungwoo-An changed the title Add promise support Add support promise Jul 1, 2019
@danawoodman
Copy link
Copy Markdown

@scravy can we get this merged? Would be nice to not have to promisify myself :)

@scravy scravy merged commit e916c58 into scravy:master Apr 21, 2020
@scravy
Copy link
Copy Markdown
Owner

scravy commented Apr 21, 2020

This has been merged and I will release it shortly as 0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants