Skip to content

Commit fd493b1

Browse files
author
4name
committed
Applies auto generated linter fixes.
1 parent 62bed0c commit fd493b1

File tree

13 files changed

+1058
-1112
lines changed

13 files changed

+1058
-1112
lines changed

example/client.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
var ssdp = require('../index').Client
2-
, client = new ssdp({})
1+
const ssdp = require('../index').Client;
2+
const client = new ssdp({});
33

44
client.on('notify', function () {
5-
//console.log('Got a notification.')
6-
})
5+
// console.log('Got a notification.')
6+
});
77

8-
client.on('response', function inResponse(headers, code, rinfo) {
9-
console.log('Got a response to an m-search:\n%d\n%s\n%s', code, JSON.stringify(headers, null, ' '), JSON.stringify(rinfo, null, ' '))
10-
})
8+
client.on('response', function inResponse (headers, code, rinfo) {
9+
console.log('Got a response to an m-search:\n%d\n%s\n%s', code, JSON.stringify(headers, null, ' '), JSON.stringify(rinfo, null, ' '));
10+
});
1111

12-
client.search('urn:schemas-upnp-org:service:ContentDirectory:1')
12+
client.search('urn:schemas-upnp-org:service:ContentDirectory:1');
1313

1414
// Or maybe if you want to scour for everything after 5 seconds
15-
setInterval(function() {
16-
client.search('ssdp:all')
17-
}, 5000)
15+
setInterval(function () {
16+
client.search('ssdp:all');
17+
}, 5000);
1818

1919
// And after 10 seconds, you want to stop
2020
// setTimeout(function () {

example/server.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
var SSDP = require('../index').Server
2-
, server = new SSDP({
3-
location: {
4-
port: 8080,
5-
path: '/ssdp/device-desc.xml'
6-
}
7-
})
1+
const SSDP = require('../index').Server;
2+
const server = new SSDP({
3+
location: {
4+
port: 8080,
5+
path: '/ssdp/device-desc.xml'
6+
}
7+
});
88

9-
server.addUSN('upnp:rootdevice')
10-
server.addUSN('urn:schemas-upnp-org:device:MediaServer:1')
11-
server.addUSN('urn:schemas-upnp-org:service:ContentDirectory:1')
12-
server.addUSN('urn:schemas-upnp-org:service:ConnectionManager:1')
9+
server.addUSN('upnp:rootdevice');
10+
server.addUSN('urn:schemas-upnp-org:device:MediaServer:1');
11+
server.addUSN('urn:schemas-upnp-org:service:ContentDirectory:1');
12+
server.addUSN('urn:schemas-upnp-org:service:ConnectionManager:1');
1313

1414
server.on('advertise-alive', function (heads) {
15-
//console.log('advertise-alive', heads)
15+
// console.log('advertise-alive', heads)
1616
// Expire old devices from your cache.
1717
// Register advertising device somewhere (as designated in http headers heads)
18-
})
18+
});
1919

2020
server.on('advertise-bye', function (heads) {
21-
//console.log('advertise-bye', heads)
21+
// console.log('advertise-bye', heads)
2222
// Remove specified device from cache.
23-
})
23+
});
2424

2525
// start server on all interfaces
2626
server.start()
2727
.catch(e => {
28-
console.log('Failed to start server:', e)
28+
console.log('Failed to start server:', e);
2929
})
3030
.then(() => {
31-
console.log('Server started.')
32-
})
31+
console.log('Server started.');
32+
});

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SOFTWARE.
2323
*/
2424

2525
module.exports = {
26-
Server: require("./lib/server"),
27-
Client: require("./lib/client"),
28-
Base: require("./lib/index")
29-
}
26+
Server: require('./lib/server'),
27+
Client: require('./lib/client'),
28+
Base: require('./lib/index')
29+
};

lib/client.js

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict'
1+
'use strict';
22

33
/*
44
MIT License
@@ -24,84 +24,77 @@
2424
SOFTWARE.
2525
*/
2626

27-
var SSDP = require('./')
28-
, util = require('util')
29-
, c = require('./const')
30-
, Promise = require('bluebird')
31-
, SsdpHeader = require('./ssdpHeader')
27+
const SSDP = require('./');
28+
const util = require('util');
29+
const c = require('./const');
30+
const Promise = require('bluebird');
31+
const SsdpHeader = require('./ssdpHeader');
3232

3333
/**
3434
*
3535
* @param opts
3636
* @constructor
3737
*/
38-
function SsdpClient(opts) {
39-
this._subclass = 'node-ssdp:client'
40-
SSDP.call(this, opts)
38+
function SsdpClient (opts) {
39+
this._subclass = 'node-ssdp:client';
40+
SSDP.call(this, opts);
4141
}
4242

43-
44-
45-
util.inherits(SsdpClient, SSDP)
46-
43+
util.inherits(SsdpClient, SSDP);
4744

4845
/**
4946
* Start the listener for multicast notifications from SSDP devices
5047
* @param [cb]
5148
*/
5249
SsdpClient.prototype.start = function (cb) {
53-
var self = this;
54-
return new Promise(function(success, failure) {
55-
function onBind(err) {
56-
if (cb) cb.apply(self, arguments)
57-
if (err) return failure(err)
58-
success()
50+
const self = this;
51+
return new Promise(function (success, failure) {
52+
function onBind (err) {
53+
if (cb) cb.apply(self, arguments);
54+
if (err) return failure(err);
55+
success();
5956
}
60-
self._start(onBind)
61-
})
62-
}
63-
57+
self._start(onBind);
58+
});
59+
};
6460

6561
/**
6662
*Close UDP socket.
6763
*/
6864
SsdpClient.prototype.stop = function () {
69-
this._stop()
70-
}
71-
65+
this._stop();
66+
};
7267

7368
/**
7469
*
7570
* @param {String} serviceType
7671
* @returns {*}
7772
*/
78-
SsdpClient.prototype.search = function search(serviceType) {
79-
var self = this
73+
SsdpClient.prototype.search = function search (serviceType) {
74+
const self = this;
8075

8176
if (!this._started) {
8277
return this.start(function () {
83-
self.search(serviceType)
84-
})
78+
self.search(serviceType);
79+
});
8580
}
8681

87-
var header = new SsdpHeader(c.M_SEARCH, {
88-
'HOST': self._ssdpServerHost,
89-
'ST': serviceType,
90-
'MAN': '"ssdp:discover"',
91-
'MX': 3
92-
})
82+
const header = new SsdpHeader(c.M_SEARCH, {
83+
HOST: self._ssdpServerHost,
84+
ST: serviceType,
85+
MAN: '"ssdp:discover"',
86+
MX: 3
87+
});
9388

94-
self._logger('Attempting to send an M-SEARCH request')
89+
self._logger('Attempting to send an M-SEARCH request');
9590

9691
self._send(header, function (err, bytes) {
9792
if (err) {
98-
self._logger('Error: unable to send M-SEARCH request ID %s: %o', header.id(), err)
93+
self._logger('Error: unable to send M-SEARCH request ID %s: %o', header.id(), err);
9994
} else {
100-
self._logger('Sent M-SEARCH request: %o', {'message': header.toString(), id: header.id()})
95+
self._logger('Sent M-SEARCH request: %o', { message: header.toString(), id: header.id() });
10196
}
102-
})
103-
}
104-
105-
97+
});
98+
};
10699

107-
module.exports = SsdpClient
100+
module.exports = SsdpClient;

lib/const.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict'
1+
'use strict';
22

33
/*
44
MIT License
@@ -34,4 +34,4 @@ module.exports = {
3434
M_SEARCH: 'm-search',
3535
SSDP_DEFAULT_IP: '239.255.255.250',
3636
SSDP_DEFAULT_PORT: 1900
37-
}
37+
};

0 commit comments

Comments
 (0)