Ues ES6 features all across util.js
This commit is contained in:
24
usb/util.js
24
usb/util.js
@@ -1,14 +1,14 @@
|
||||
var usb = require('usb');
|
||||
let usb = require('usb');
|
||||
|
||||
exports = module.exports = {
|
||||
getUsbEndpoints: function() {
|
||||
var vid = 0x16d3;
|
||||
var pid = 0x05ea;
|
||||
getUsbEndpoints: () => {
|
||||
let vid = 0x16d3;
|
||||
let pid = 0x05ea;
|
||||
|
||||
var device = usb.findByIds(vid, pid);
|
||||
let device = usb.findByIds(vid, pid);
|
||||
device.open();
|
||||
|
||||
var usbInterface = device.interface(0);
|
||||
let usbInterface = device.interface(0);
|
||||
|
||||
// https://github.com/tessel/node-usb/issues/147
|
||||
// The function 'isKernelDriverActive' is not available on Windows and not even needed.
|
||||
@@ -17,15 +17,15 @@ exports = module.exports = {
|
||||
}
|
||||
usbInterface.claim();
|
||||
|
||||
var endpointIn = usbInterface.endpoints[0];
|
||||
var endpointOut = usbInterface.endpoints[1];
|
||||
let endpointIn = usbInterface.endpoints[0];
|
||||
let endpointOut = usbInterface.endpoints[1];
|
||||
return [endpointIn, endpointOut];
|
||||
},
|
||||
|
||||
bufferToString: function(buffer) {
|
||||
var str = '';
|
||||
for (var i = 0; i < buffer.length; i++) {
|
||||
var hex = buffer[i].toString(16) + ' ';
|
||||
bufferToString: buffer => {
|
||||
let str = '';
|
||||
for (let i = 0; i < buffer.length; i++) {
|
||||
let hex = buffer[i].toString(16) + ' ';
|
||||
if (hex.length <= 2) {
|
||||
hex = '0' + hex;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user