Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit b8ee62d

Browse files
committed
status-bar-view remove guard
1 parent 81ed012 commit b8ee62d

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

lib/status-bar-view.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/*
33
* decaffeinate suggestions:
44
* DS102: Remove unnecessary code created because of implicit returns
5-
* DS103: Rewrite code to no longer use __guard__
65
* DS205: Consider reworking code to avoid use of IIFEs
76
* DS207: Consider shorter variations of null checks
87
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
@@ -116,7 +115,12 @@ export default StatusBarView = class StatusBarView {
116115
}
117116

118117
storeActiveBuffer() {
119-
return this.buffer = __guardMethod__(this.getActiveItem(), 'getBuffer', o => o.getBuffer());
118+
const activeItem = this.getActiveItem();
119+
if (activeItem) {
120+
if (typeof activeItem.getBuffer() == "function") {
121+
this.buffer = activeItem.getBuffer();
122+
}
123+
}
120124
}
121125

122126
subscribeToBuffer(event, callback) {
@@ -146,11 +150,3 @@ export default StatusBarView = class StatusBarView {
146150
})();
147151
}
148152
};
149-
150-
function __guardMethod__(obj, methodName, transform) {
151-
if (typeof obj !== 'undefined' && obj !== null && typeof obj[methodName] === 'function') {
152-
return transform(obj, methodName);
153-
} else {
154-
return undefined;
155-
}
156-
}

0 commit comments

Comments
 (0)