{"action":"created","comment":{"url":"https://api.github.com/repos/virtuecoder/Jota/pulls/comments/184092379","pull_request_review_id":115216817,"id":184092379,"diff_hunk":"@@ -0,0 +1,111 @@\n+export default class Formatter {\n+  constructor() {\n+    this.templates = {};\n+  }\n+\n+  addTemplate({name: name, template: template}) {\n+    this.templates[name] = template;\n+  }\n+\n+  removeTemplate(name) {\n+    delete this.templates[name];\n+  }\n+\n+  format(templateName, passage) {\n+    return format(this.templates[templateName], passage);\n+  }\n+}\n+\n+function format(template, passage) {\n+  const bookName = Object.keys(passage)[0];\n+  const bookContent = passage[bookName];\n+\n+  const chapterNumbers = Object.keys(bookContent);\n+  const chapterStart = chapterNumbers[0];\n+  const chapterEnd = last(chapterNumbers);\n+\n+  const verseStart = Object.keys(bookContent[chapterStart])[0];\n+  const verseEnd = last(Object.keys(bookContent[chapterEnd]));\n+\n+  const verses = versesFrom(bookContent);\n+\n+  const formatters = contentFormatters(template);\n+\n+  return formatWith({\n+    template: template,\n+    book: bookName,\n+    chapter: chapterStart,\n+    chapterStart: chapterStart,\n+    chapterEnd: chapterEnd,\n+    verseStart: verseStart,\n+    verseEnd: verseEnd,\n+    verse: verseStart,\n+    text: formatters.text(verses),\n+    textWithNumbers: formatters.textWithNumbers(verses),\n+    textWithLineBreaks: formatters.textWithLineBreaks(verses),\n+    textWithNumbersAndLineBreaks: formatters.textWithNumbersAndLineBreaks(verses)\n+  })\n+}\n+\n+function versesFrom(bookContent) {\n+  return Object.entries(bookContent)\n+    .map(hasMoreThanOneChapter(bookContent) ? extractVersesWithChapterNumber : extractVerses)","path":"src/passage-format.js","position":52,"original_position":52,"commit_id":"c77ebc089ebc22607eccadf082e2f9b6c536ea14","original_commit_id":"c77ebc089ebc22607eccadf082e2f9b6c536ea14","user":{"login":"birdbird314","id":18380899,"avatar_url":"https://avatars3.githubusercontent.com/u/18380899?v=4","gravatar_id":"","url":"https://api.github.com/users/birdbird314","html_url":"https://github.com/birdbird314","followers_url":"https://api.github.com/users/birdbird314/followers","following_url":"https://api.github.com/users/birdbird314/following{/other_user}","gists_url":"https://api.github.com/users/birdbird314/gists{/gist_id}","starred_url":"https://api.github.com/users/birdbird314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birdbird314/subscriptions","organizations_url":"https://api.github.com/users/birdbird314/orgs","repos_url":"https://api.github.com/users/birdbird314/repos","events_url":"https://api.github.com/users/birdbird314/events{/privacy}","received_events_url":"https://api.github.com/users/birdbird314/received_events","type":"User","site_admin":false},"body":"I've checked this and it'll be executed only once to pass proper function to `map` and then execute a loop","created_at":"2018-04-25T14:58:17Z","updated_at":"2018-04-25T14:58:17Z","html_url":"https://github.com/virtuecoder/Jota/pull/2#discussion_r184092379","pull_request_url":"https://api.github.com/repos/virtuecoder/Jota/pulls/2","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/virtuecoder/Jota/pulls/comments/184092379"},"html":{"href":"https://github.com/virtuecoder/Jota/pull/2#discussion_r184092379"},"pull_request":{"href":"https://api.github.com/repos/virtuecoder/Jota/pulls/2"}},"in_reply_to_id":183797291},"pull_request":{"url":"https://api.github.com/repos/virtuecoder/Jota/pulls/2","id":181700021,"html_url":"https://github.com/virtuecoder/Jota/pull/2","diff_url":"https://github.com/virtuecoder/Jota/pull/2.diff","patch_url":"https://github.com/virtuecoder/Jota/pull/2.patch","issue_url":"https://api.github.com/repos/virtuecoder/Jota/issues/2","number":2,"state":"open","locked":false,"title":"Format verses according to given template","user":{"login":"birdbird314","id":18380899,"avatar_url":"https://avatars3.githubusercontent.com/u/18380899?v=4","gravatar_id":"","url":"https://api.github.com/users/birdbird314","html_url":"https://github.com/birdbird314","followers_url":"https://api.github.com/users/birdbird314/followers","following_url":"https://api.github.com/users/birdbird314/following{/other_user}","gists_url":"https://api.github.com/users/birdbird314/gists{/gist_id}","starred_url":"https://api.github.com/users/birdbird314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birdbird314/subscriptions","organizations_url":"https://api.github.com/users/birdbird314/orgs","repos_url":"https://api.github.com/users/birdbird314/repos","events_url":"https://api.github.com/users/birdbird314/events{/privacy}","received_events_url":"https://api.github.com/users/birdbird314/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-15T13:52:47Z","updated_at":"2018-04-25T14:58:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d28fdd1f55865d10ca4f6ad2787bb2f6ff5eff64","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/virtuecoder/Jota/pulls/2/commits","review_comments_url":"https://api.github.com/repos/virtuecoder/Jota/pulls/2/comments","review_comment_url":"https://api.github.com/repos/virtuecoder/Jota/pulls/comments{/number}","comments_url":"https://api.github.com/repos/virtuecoder/Jota/issues/2/comments","statuses_url":"https://api.github.com/repos/virtuecoder/Jota/statuses/c77ebc089ebc22607eccadf082e2f9b6c536ea14","head":{"label":"birdbird314:templates_v2","ref":"templates_v2","sha":"c77ebc089ebc22607eccadf082e2f9b6c536ea14","user":{"login":"birdbird314","id":18380899,"avatar_url":"https://avatars3.githubusercontent.com/u/18380899?v=4","gravatar_id":"","url":"https://api.github.com/users/birdbird314","html_url":"https://github.com/birdbird314","followers_url":"https://api.github.com/users/birdbird314/followers","following_url":"https://api.github.com/users/birdbird314/following{/other_user}","gists_url":"https://api.github.com/users/birdbird314/gists{/gist_id}","starred_url":"https://api.github.com/users/birdbird314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birdbird314/subscriptions","organizations_url":"https://api.github.com/users/birdbird314/orgs","repos_url":"https://api.github.com/users/birdbird314/repos","events_url":"https://api.github.com/users/birdbird314/events{/privacy}","received_events_url":"https://api.github.com/users/birdbird314/received_events","type":"User","site_admin":false},"repo":{"id":127944653,"name":"Jota","full_name":"birdbird314/Jota","owner":{"login":"birdbird314","id":18380899,"avatar_url":"https://avatars3.githubusercontent.com/u/18380899?v=4","gravatar_id":"","url":"https://api.github.com/users/birdbird314","html_url":"https://github.com/birdbird314","followers_url":"https://api.github.com/users/birdbird314/followers","following_url":"https://api.github.com/users/birdbird314/following{/other_user}","gists_url":"https://api.github.com/users/birdbird314/gists{/gist_id}","starred_url":"https://api.github.com/users/birdbird314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/birdbird314/subscriptions","organizations_url":"https://api.github.com/users/birdbird314/orgs","repos_url":"https://api.github.com/users/birdbird314/repos","events_url":"https://api.github.com/users/birdbird314/events{/privacy}","received_events_url":"https://api.github.com/users/birdbird314/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/birdbird314/Jota","description":"Handy program to browse and search the Bible","fork":true,"url":"https://api.github.com/repos/birdbird314/Jota","forks_url":"https://api.github.com/repos/birdbird314/Jota/forks","keys_url":"https://api.github.com/repos/birdbird314/Jota/keys{/key_id}","collaborators_url":"https://api.github.com/repos/birdbird314/Jota/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/birdbird314/Jota/teams","hooks_url":"https://api.github.com/repos/birdbird314/Jota/hooks","issue_events_url":"https://api.github.com/repos/birdbird314/Jota/issues/events{/number}","events_url":"https://api.github.com/repos/birdbird314/Jota/events","assignees_url":"https://api.github.com/repos/birdbird314/Jota/assignees{/user}","branches_url":"https://api.github.com/repos/birdbird314/Jota/branches{/branch}","tags_url":"https://api.github.com/repos/birdbird314/Jota/tags","blobs_url":"https://api.github.com/repos/birdbird314/Jota/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/birdbird314/Jota/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/birdbird314/Jota/git/refs{/sha}","trees_url":"https://api.github.com/repos/birdbird314/Jota/git/trees{/sha}","statuses_url":"https://api.github.com/repos/birdbird314/Jota/statuses/{sha}","languages_url":"https://api.github.com/repos/birdbird314/Jota/languages","stargazers_url":"https://api.github.com/repos/birdbird314/Jota/stargazers","contributors_url":"https://api.github.com/repos/birdbird314/Jota/contributors","subscribers_url":"https://api.github.com/repos/birdbird314/Jota/subscribers","subscription_url":"https://api.github.com/repos/birdbird314/Jota/subscription","commits_url":"https://api.github.com/repos/birdbird314/Jota/commits{/sha}","git_commits_url":"https://api.github.com/repos/birdbird314/Jota/git/commits{/sha}","comments_url":"https://api.github.com/repos/birdbird314/Jota/comments{/number}","issue_comment_url":"https://api.github.com/repos/birdbird314/Jota/issues/comments{/number}","contents_url":"https://api.github.com/repos/birdbird314/Jota/contents/{+path}","compare_url":"https://api.github.com/repos/birdbird314/Jota/compare/{base}...{head}","merges_url":"https://api.github.com/repos/birdbird314/Jota/merges","archive_url":"https://api.github.com/repos/birdbird314/Jota/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/birdbird314/Jota/downloads","issues_url":"https://api.github.com/repos/birdbird314/Jota/issues{/number}","pulls_url":"https://api.github.com/repos/birdbird314/Jota/pulls{/number}","milestones_url":"https://api.github.com/repos/birdbird314/Jota/milestones{/number}","notifications_url":"https://api.github.com/repos/birdbird314/Jota/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/birdbird314/Jota/labels{/name}","releases_url":"https://api.github.com/repos/birdbird314/Jota/releases{/id}","deployments_url":"https://api.github.com/repos/birdbird314/Jota/deployments","created_at":"2018-04-03T17:33:42Z","updated_at":"2018-04-03T18:39:27Z","pushed_at":"2018-04-21T15:32:44Z","git_url":"git://github.com/birdbird314/Jota.git","ssh_url":"git@github.com:birdbird314/Jota.git","clone_url":"https://github.com/birdbird314/Jota.git","svn_url":"https://github.com/birdbird314/Jota","homepage":null,"size":28,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"virtuecoder:master","ref":"master","sha":"cf53be861723a381c10eef655f52cd8e9a4f5888","user":{"login":"virtuecoder","id":1092912,"avatar_url":"https://avatars3.githubusercontent.com/u/1092912?v=4","gravatar_id":"","url":"https://api.github.com/users/virtuecoder","html_url":"https://github.com/virtuecoder","followers_url":"https://api.github.com/users/virtuecoder/followers","following_url":"https://api.github.com/users/virtuecoder/following{/other_user}","gists_url":"https://api.github.com/users/virtuecoder/gists{/gist_id}","starred_url":"https://api.github.com/users/virtuecoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virtuecoder/subscriptions","organizations_url":"https://api.github.com/users/virtuecoder/orgs","repos_url":"https://api.github.com/users/virtuecoder/repos","events_url":"https://api.github.com/users/virtuecoder/events{/privacy}","received_events_url":"https://api.github.com/users/virtuecoder/received_events","type":"User","site_admin":false},"repo":{"id":115610872,"name":"Jota","full_name":"virtuecoder/Jota","owner":{"login":"virtuecoder","id":1092912,"avatar_url":"https://avatars3.githubusercontent.com/u/1092912?v=4","gravatar_id":"","url":"https://api.github.com/users/virtuecoder","html_url":"https://github.com/virtuecoder","followers_url":"https://api.github.com/users/virtuecoder/followers","following_url":"https://api.github.com/users/virtuecoder/following{/other_user}","gists_url":"https://api.github.com/users/virtuecoder/gists{/gist_id}","starred_url":"https://api.github.com/users/virtuecoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/virtuecoder/subscriptions","organizations_url":"https://api.github.com/users/virtuecoder/orgs","repos_url":"https://api.github.com/users/virtuecoder/repos","events_url":"https://api.github.com/users/virtuecoder/events{/privacy}","received_events_url":"https://api.github.com/users/virtuecoder/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/virtuecoder/Jota","description":"Handy program to browse and search the Bible","fork":false,"url":"https://api.github.com/repos/virtuecoder/Jota","forks_url":"https://api.github.com/repos/virtuecoder/Jota/forks","keys_url":"https://api.github.com/repos/virtuecoder/Jota/keys{/key_id}","collaborators_url":"https://api.github.com/repos/virtuecoder/Jota/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/virtuecoder/Jota/teams","hooks_url":"https://api.github.com/repos/virtuecoder/Jota/hooks","issue_events_url":"https://api.github.com/repos/virtuecoder/Jota/issues/events{/number}","events_url":"https://api.github.com/repos/virtuecoder/Jota/events","assignees_url":"https://api.github.com/repos/virtuecoder/Jota/assignees{/user}","branches_url":"https://api.github.com/repos/virtuecoder/Jota/branches{/branch}","tags_url":"https://api.github.com/repos/virtuecoder/Jota/tags","blobs_url":"https://api.github.com/repos/virtuecoder/Jota/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/virtuecoder/Jota/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/virtuecoder/Jota/git/refs{/sha}","trees_url":"https://api.github.com/repos/virtuecoder/Jota/git/trees{/sha}","statuses_url":"https://api.github.com/repos/virtuecoder/Jota/statuses/{sha}","languages_url":"https://api.github.com/repos/virtuecoder/Jota/languages","stargazers_url":"https://api.github.com/repos/virtuecoder/Jota/stargazers","contributors_url":"https://api.github.com/repos/virtuecoder/Jota/contributors","subscribers_url":"https://api.github.com/repos/virtuecoder/Jota/subscribers","subscription_url":"https://api.github.com/repos/virtuecoder/Jota/subscription","commits_url":"https://api.github.com/repos/virtuecoder/Jota/commits{/sha}","git_commits_url":"https://api.github.com/repos/virtuecoder/Jota/git/commits{/sha}","comments_url":"https://api.github.com/repos/virtuecoder/Jota/comments{/number}","issue_comment_url":"https://api.github.com/repos/virtuecoder/Jota/issues/comments{/number}","contents_url":"https://api.github.com/repos/virtuecoder/Jota/contents/{+path}","compare_url":"https://api.github.com/repos/virtuecoder/Jota/compare/{base}...{head}","merges_url":"https://api.github.com/repos/virtuecoder/Jota/merges","archive_url":"https://api.github.com/repos/virtuecoder/Jota/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/virtuecoder/Jota/downloads","issues_url":"https://api.github.com/repos/virtuecoder/Jota/issues{/number}","pulls_url":"https://api.github.com/repos/virtuecoder/Jota/pulls{/number}","milestones_url":"https://api.github.com/repos/virtuecoder/Jota/milestones{/number}","notifications_url":"https://api.github.com/repos/virtuecoder/Jota/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/virtuecoder/Jota/labels{/name}","releases_url":"https://api.github.com/repos/virtuecoder/Jota/releases{/id}","deployments_url":"https://api.github.com/repos/virtuecoder/Jota/deployments","created_at":"2017-12-28T10:07:20Z","updated_at":"2018-04-04T18:49:57Z","pushed_at":"2018-04-21T15:32:45Z","git_url":"git://github.com/virtuecoder/Jota.git","ssh_url":"git@github.com:virtuecoder/Jota.git","clone_url":"https://github.com/virtuecoder/Jota.git","svn_url":"https://github.com/virtuecoder/Jota","homepage":null,"size":22,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/virtuecoder/Jota/pulls/2"},"html":{"href":"https://github.com/virtuecoder/Jota/pull/2"},"issue":{"href":"https://api.github.com/repos/virtuecoder/Jota/issues/2"},"comments":{"href":"https://api.github.com/repos/virtuecoder/Jota/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/virtuecoder/Jota/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/virtuecoder/Jota/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/virtuecoder/Jota/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/virtuecoder/Jota/statuses/c77ebc089ebc22607eccadf082e2f9b6c536ea14"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"birdbird314"}}