From 80f424e9d8cd025cce6a3c22cea62a3ad37024ea Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Fri, 17 May 2024 14:07:48 +0800 Subject: [PATCH] added ability to provide default value to `getOption` method on modalsManager service --- addon/services/modals-manager.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addon/services/modals-manager.js b/addon/services/modals-manager.js index 040cbeb..75b2997 100644 --- a/addon/services/modals-manager.js +++ b/addon/services/modals-manager.js @@ -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; } /**