Support scoped settings in getDefault

This commit is contained in:
Ben Ogle
2014-10-15 15:11:19 -07:00
parent 62c1972c95
commit ae857203fd
2 changed files with 23 additions and 2 deletions

View File

@@ -530,8 +530,16 @@ class Config
# * `keyPath` The {String} name of the key.
#
# Returns the default value.
getDefault: (keyPath) ->
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
getDefault: (scopeSelector, keyPath) ->
if arguments.length == 1
keyPath = scopeSelector
scopeSelector = null
if scopeSelector?
defaultValue = @scopedSettingsStore.getPropertyValue(scopeSelector, keyPath, excludeSources: ['user-config'])
defaultValue ?= _.valueForKeyPath(@defaultSettings, keyPath)
else
defaultValue = _.valueForKeyPath(@defaultSettings, keyPath)
_.deepClone(defaultValue)
# Extended: Is the value at `keyPath` its default value?