mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Write empty object values on same line as keys
This commit is contained in:
@@ -73,6 +73,8 @@ describe "CSON", ->
|
||||
|
||||
it "returns formatted CSON", ->
|
||||
expect(CSON.stringify(a: {b: 'c'})).toBe "'a':\n 'b': 'c'"
|
||||
expect(CSON.stringify(a:{})).toBe "'a': {}"
|
||||
expect(CSON.stringify(a:[])).toBe "'a': []"
|
||||
|
||||
describe "when converting back to an object", ->
|
||||
it "produces the original object", ->
|
||||
|
||||
@@ -94,7 +94,10 @@ module.exports =
|
||||
else if _.isArray(value)
|
||||
cson += " #{@stringifyArray(value, indentLevel)}"
|
||||
else if _.isObject(value)
|
||||
cson += "\n#{@stringifyObject(value, indentLevel + 2)}"
|
||||
if _.isEmpty(value)
|
||||
cson += ' {}'
|
||||
else
|
||||
cson += "\n#{@stringifyObject(value, indentLevel + 2)}"
|
||||
else
|
||||
throw new Error("Unrecognized value type for key: #{key} with value: #{value}")
|
||||
prefix = '\n'
|
||||
|
||||
Reference in New Issue
Block a user