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

Commit 5a17396

Browse files
committed
status-bar-view remove guard
1 parent f9d4e79 commit 5a17396

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/status-bar-view.js

Lines changed: 4 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,10 @@ 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+
this.buffer = activeItem.getBuffer();
121+
}
120122
}
121123

122124
subscribeToBuffer(event, callback) {
@@ -146,11 +148,3 @@ export default StatusBarView = class StatusBarView {
146148
})();
147149
}
148150
};
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)