trezor-link
Advanced tools
Comparing version 0.1.19 to 0.1.20
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); } | ||
@@ -143,2 +145,11 @@ | ||
_filter(name, devices) { | ||
return devices.filter(device => this._parseName(name).name === name).map(device => { | ||
return _extends({}, device, { | ||
path: this._parseName(device.path).rest, | ||
session: device.session == null ? device.session : this._parseName(device.session).rest | ||
}); | ||
}); | ||
} | ||
enumerate() { | ||
@@ -170,3 +181,3 @@ return new Promise(function ($return, $error) { | ||
return new Promise(function ($return, $error) { | ||
var res, devices, name, $iterator_name; | ||
var res, oldFiltered, devices, name, $iterator_name; | ||
res = []; | ||
@@ -180,3 +191,4 @@ $iterator_name = [Object.keys(this.transports)[Symbol.iterator]()]; | ||
if (!($iterator_name[1] = $iterator_name[0].next()).done && ((name = $iterator_name[1].value) || true)) { | ||
return this.transports[name].listen(old).then(function ($await_11) { | ||
oldFiltered = old == null ? null : this._filter(name, old); | ||
return this.transports[name].listen(oldFiltered).then(function ($await_11) { | ||
devices = $await_11; | ||
@@ -183,0 +195,0 @@ |
{ | ||
"name": "trezor-link", | ||
"version": "0.1.19", | ||
"version": "0.1.20", | ||
"description": "Trezor Link", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -22,2 +22,12 @@ /* @flow */ | ||
_filter(name: string, devices: Array<TrezorDeviceInfoWithSession>): Array<TrezorDeviceInfoWithSession> { | ||
return devices.filter(device => this._parseName(name).name === name).map(device => { | ||
return { | ||
...device, | ||
path: this._parseName(device.path).rest, | ||
session: device.session == null ? device.session : this._parseName(device.session).rest, | ||
}; | ||
}); | ||
} | ||
async enumerate(): Promise<Array<TrezorDeviceInfoWithSession>> { | ||
@@ -37,3 +47,4 @@ const res = []; | ||
for (let name of Object.keys(this.transports)) { | ||
const devices = await this.transports[name].listen(old); | ||
const oldFiltered = old == null ? null : this._filter(name, old); | ||
const devices = await this.transports[name].listen(oldFiltered); | ||
res.push(...(this._prepend(name, devices))); | ||
@@ -40,0 +51,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
284901
5556