Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

Commit

Permalink
Fix flow
Browse files Browse the repository at this point in the history
  • Loading branch information
gre committed Jul 10, 2018
1 parent 75e8748 commit 7535fb9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/hw-transport-node-hid/src/TransportNodeHid.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export default class TransportNodeHid extends Transport<string> {
device: HID.HID;
ledgerTransport: boolean;
timeout: number;
debug: boolean;
exchangeStack: Array<*>;

constructor(
Expand Down Expand Up @@ -244,8 +243,9 @@ export default class TransportNodeHid extends Transport<string> {
const deferred = this.exchangeStack[0];

const send = content => {
if (this.debug) {
this.debug("=>" + content.toString("hex"));
const { debug } = this;
if (debug) {
debug("=>" + content.toString("hex"));
}
const data = [0x00];
for (let i = 0; i < content.length; i++) {
Expand All @@ -261,8 +261,9 @@ export default class TransportNodeHid extends Transport<string> {
if (err || !res) reject(err);
else {
const buffer = Buffer.from(res);
if (this.debug) {
this.debug("<=" + buffer.toString("hex"));
const { debug } = this;
if (debug) {
debug("<=" + buffer.toString("hex"));
}
resolve(buffer);
}
Expand Down

0 comments on commit 7535fb9

Please sign in to comment.