Use newfound ninja skills to refactor stuff

This commit is contained in:
Vit Brunner
2013-06-16 11:52:28 +01:00
parent 5a820848b8
commit 8bfbb29e9f
2 changed files with 8 additions and 14 deletions
@@ -9,15 +9,12 @@ angular.module("sideBySide").factory("jsonReader", () ->
return (source) ->
parsed = eval('(' + source + ')')
newContent = []
for verse in parsed.content
for i,verse of parsed.content
if typeof(verse) == "string"
newContent.push({ section: "", text: verse })
parsed.content[i] = { section: "", text: verse }
else
if "section" not of verse
verse.section = ""
newContent.push(verse)
verse.section = "" if "section" not of verse
parsed.content[i] = verse
parsed.content = newContent
return parsed
)