Allow null keyPath with options argument in ::get

This commit is contained in:
Max Brunsfeld 2014-12-12 15:31:34 -08:00
parent d30cf35a16
commit f859ad5fc5
2 changed files with 3 additions and 1 deletions

View File

@ -47,6 +47,8 @@ describe "Config", ->
# Schema defaults never match a specific source. We could potentially add a special "schema" source. # Schema defaults never match a specific source. We could potentially add a special "schema" source.
expect(atom.config.get("x.y", sources: ["x"], scope: [".foo"])).toBeUndefined() expect(atom.config.get("x.y", sources: ["x"], scope: [".foo"])).toBeUndefined()
expect(atom.config.get(null, sources: ['a'], scope: [".foo"]).x.y).toBe 1
describe "when an 'excludeSources' option is specified", -> describe "when an 'excludeSources' option is specified", ->
it "only retrieves values from the specified sources", -> it "only retrieves values from the specified sources", ->
atom.config.set("x.y", 1, scopeSelector: ".foo", source: "a") atom.config.set("x.y", 1, scopeSelector: ".foo", source: "a")

View File

@ -457,7 +457,7 @@ class Config
# file in the type specified by the configuration schema. # file in the type specified by the configuration schema.
get: -> get: ->
if arguments.length > 1 if arguments.length > 1
if typeof arguments[0] is 'string' if typeof arguments[0] is 'string' or not arguments[0]?
keyPath = arguments[0] keyPath = arguments[0]
options = arguments[1] options = arguments[1]
{scope} = options {scope} = options