Skip to content

Commit

Permalink
If property value is non-function, convert it to a function that retu…
Browse files Browse the repository at this point in the history
…rns that value
  • Loading branch information
ycombinator committed Jul 5, 2016
1 parent fb85412 commit 0b0280c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ui/public/kbn_top_nav/kbn_top_nav_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ export default function ($compile) {
label: capitalize(opt.key),
hasFunction: !!opt.run,
description: opt.run ? opt.key : `Toggle ${opt.key} view`,
hideButton: isFunction(opt.hideButton) ? opt.hideButton : () => false,
disableButton: isFunction(opt.disableButton) ? opt.disableButton : () => false,
tooltip: isFunction(opt.tooltip) ? opt.tooltip : () => '',
hideButton: isFunction(opt.hideButton) ? opt.hideButton : () => (opt.hideButton || false),
disableButton: isFunction(opt.disableButton) ? opt.disableButton : () => (opt.disableButton || false),
tooltip: isFunction(opt.tooltip) ? opt.tooltip : () => (opt.tooltip || ''),
run: (item) => !item.disableButton() && this.toggle(item.key)
});
}
Expand Down

0 comments on commit 0b0280c

Please sign in to comment.