Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
martinheidegger committed Mar 20, 2020
1 parent 8d36625 commit 044ee4a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion get-active/other.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'
// Thanks to https://github.com/tomas/network/blob/626414497f5e79c8299e3379e58d952f6b07703f/lib/darwin.js#L35-L46
const cmd = `netstat -rn | grep UG | awk '{print $6}'`
const cmd = 'netstat -rn | grep UG | awk \'{print $6}\''
const bgbash = require('bgbash')

module.exports = cb => {
Expand Down
16 changes: 10 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ const ChangeType = require('./const/change-type.js')
const DEFAULT_MAX_AGE = 250

function keyForInfo (interfaceId, info) {
return JSON.stringify([
const parts = [
interfaceId,
info.mac,
info.family,
info['scopeid'] || 0
])
info.scopeid || 0
]
if (info.family === Family.IPv6) {
parts.push(info.netmask)
}
return JSON.stringify(parts)
}

function createNetworkInfo (interfaceId, activeInterfaceId, nicTypes) {
Expand Down Expand Up @@ -165,7 +169,7 @@ class NetworkInterfaces extends EventEmitter {
updateActiveInterfaceId () {
getActive((cause, activeInterfaceId) => {
if (cause) {
this.emit('warning', Object.assign(new Error(`Couldn't identify the active interface.`), {
this.emit('warning', Object.assign(new Error('Couldn\'t identify the active interface.'), {
code: 'EACTIVEERR',
cause: cause.stack || cause
}))
Expand All @@ -180,7 +184,7 @@ class NetworkInterfaces extends EventEmitter {
updateNicTypes () {
getNicTypes((cause, data) => {
if (cause) {
this.emit('warning', Object.assign(new Error(`Wasn't able to lookup the interfaces.`), {
this.emit('warning', Object.assign(new Error('Wasn\'t able to lookup the interfaces.'), {
code: 'ENICTYPE',
cause: cause.stack || cause
}))
Expand Down Expand Up @@ -315,7 +319,7 @@ class NetworkInterfaces extends EventEmitter {

_deleteLocalLookup (entry) {
const { family } = entry
let localAddresses = this._localAddressByFamily.get(family)
const localAddresses = this._localAddressByFamily.get(family)
if (localAddresses === undefined) {
return
}
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
"author": "Martin Heidegger <martin.heidegger@gmail.com>",
"license": "MIT",
"devDependencies": {
"@types/node": "^11.12.0",
"standard": "^12.0.1",
"standard-version": "^5.0.2",
"tap": "^12.6.1"
"@types/node": "^13.9.2",
"standard": "^14.3.3",
"standard-version": "^7.1.0",
"tap": "^14.10.7"
},
"dependencies": {
"bgbash": "^1.0.0",
"fast-deep-equal": "^2.0.1",
"fast-deep-equal": "^3.1.1",
"has-listener": "^1.1.1",
"object-hash": "^1.3.1",
"wmic": "^0.3.0"
"object-hash": "^2.0.3",
"wmic": "^0.4.0"
},
"repository": {
"type": "git",
Expand Down
7 changes: 4 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ test('networkinterfaces', t => {
}
t.notEquals(os.networkInterfaces, _backup.networkInterfaces, 'interfaces mock enabled')

let getActive = cb => setImmediate(cb, null, null)
const getActive = cb => setImmediate(cb, null, null)
getActiveModule.getActive = cb => getActive(cb)
t.pass('active mock enabled')

let getNicTypes = cb => setImmediate(cb, null, {})
const getNicTypes = cb => setImmediate(cb, null, {})
getNicTypesModule.getNicTypes = cb => getNicTypes(cb)
t.pass('nicTypes mock enabled')

Expand Down Expand Up @@ -158,7 +158,8 @@ test('networkinterfaces', t => {
n.update()
t.deepEquals(changes, [
{ type: 'add-address', address: { family: 'c', mac: 'do', key: '["lo","do","c",0]', hash: '67f871cd6359b9b2cdcc321ac0a6c6d2acdae78f', interfaceId: 'lo' } },
{ type: 'update-address',
{
type: 'update-address',
address: { family: 'b', mac: 'bo', address: 'x', key: '["lo","bo","b",0]', hash: '3919b087a3f56f5c4bf969bc8d765af84563abe6', interfaceId: 'lo' },
oldAddress: { family: 'b', mac: 'bo', key: '["lo","bo","b",0]', hash: 'd98c1364c3131ab8fe28a3698baacfd88cd9f34d', interfaceId: 'lo' }
},
Expand Down

0 comments on commit 044ee4a

Please sign in to comment.