Skip to content

Commit

Permalink
added ability to provide default value to getOption method on modal…
Browse files Browse the repository at this point in the history
…sManager service
  • Loading branch information
roncodes committed May 17, 2024
1 parent 55f5cd0 commit 80f424e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions addon/services/modals-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,14 +288,20 @@ export default class ModalsManagerService extends Service {
* Retrieves an option
*
* @param {String} key
* @param {Mixed} defaultValue
* @return {Mixed}
*/
@action getOption(key) {
@action getOption(key, defaultValue = null) {
if (isArray(key)) {
return this.getOptions(key);
}

return get(this.options, key);
const value = get(this.options, key);
if (value === undefined) {
return defaultValue;
}

return value;
}

/**
Expand Down

0 comments on commit 80f424e

Please sign in to comment.