mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Extract _.setValueForKeyPath to underscore extensions
This commit is contained in:
@@ -47,14 +47,7 @@ class Config
|
||||
_.valueForKeyPath(@defaultSettings, keyPath)
|
||||
|
||||
set: (keyPath, value) ->
|
||||
keys = keyPath.split('.')
|
||||
hash = @settings
|
||||
while keys.length > 1
|
||||
key = keys.shift()
|
||||
hash[key] ?= {}
|
||||
hash = hash[key]
|
||||
hash[keys.shift()] = value
|
||||
|
||||
_.setValueForKeyPath(@settings, keyPath, value)
|
||||
@update()
|
||||
value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user