{"action":"created","comment":{"url":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/comments/167829004","pull_request_review_id":96100807,"id":167829004,"diff_hunk":"@@ -0,0 +1,35 @@\n+const requiredForMonetary = [ 'locale', 'abbreviation' ];\n+const requiredForNonMonetary = [ 'singularName', 'pluralName', 'templateString' ];\n+\n+/**\n+ * Takes some basic currency information and formats it in a locale-specific way.\n+ * @param {Number} amount This is how much\n+ * @param {Object} options This configures the display of the currency\n+ * @param {Boolean} options.isMoney Indicates wether this is monetary (euro) or not (a phone)\n+ * @param {String} options.locale For `isMoney: true`, this determines which locate to use (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat)\n+ * @param {String} options.abbreviation An ISO 4217 designation for a monetary currency (https://en.wikipedia.org/wiki/ISO_4217)\n+ * @param {String} options.singularName For `isMoney: false`, this is displayed as NAME in the case of 1\n+ * @param {String} options.pluralName For `isMoney: false`, this is displayed as NAME in the case of >1\n+ * @param {String} options.templateString For `isMoney: false`, this specifies how the currency will get rendered. The strings `NAME` and `AMOUNT` will be replaced.\n+ * @return {String} in the case of isMoney, returns a local-sepcific currency string.\n+ * In the case of a non-monetary one, it uses a string template to format everything.\n+*/\n+const formatCurrency = (amount, options) => {\n+  if (typeof options.isMoney === 'undefined') throw new Error('options.isMoney is not set');\n+  \n+  (options.isMoney ? requiredForMonetary : requiredForNonMonetary).forEach(prop => {\n+    if (typeof options[prop] === 'undefined') throw new Error(`options.${prop} is not set`);\n+  });\n+\n+  if (options.isMoney) {\n+    return new Intl.NumberFormat(options.locale, {\n+      style: 'currency',\n+      currency: options.abbreviation,\n+    }).format(amount);\n+  } else {\n+    const name = amount > 1 ? options.pluralName : options.singularName;\n+    return options.templateString.replace('AMOUNT', amount).replace('NAME', name);","path":"helpers/currency-format.js","position":null,"original_position":31,"commit_id":"b9c5d1f3e43a99d586fa484e8bb2777ab203e9a3","original_commit_id":"16674d0261bef4e8d2264094742450e3d3f2aa0f","user":{"login":"mtimofiiv","id":428948,"avatar_url":"https://avatars2.githubusercontent.com/u/428948?v=4","gravatar_id":"","url":"https://api.github.com/users/mtimofiiv","html_url":"https://github.com/mtimofiiv","followers_url":"https://api.github.com/users/mtimofiiv/followers","following_url":"https://api.github.com/users/mtimofiiv/following{/other_user}","gists_url":"https://api.github.com/users/mtimofiiv/gists{/gist_id}","starred_url":"https://api.github.com/users/mtimofiiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtimofiiv/subscriptions","organizations_url":"https://api.github.com/users/mtimofiiv/orgs","repos_url":"https://api.github.com/users/mtimofiiv/repos","events_url":"https://api.github.com/users/mtimofiiv/events{/privacy}","received_events_url":"https://api.github.com/users/mtimofiiv/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2018-02-13T10:58:46Z","updated_at":"2018-02-13T10:58:47Z","html_url":"https://github.com/mgmco/handlebar-helpers/pull/1#discussion_r167829004","pull_request_url":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/1","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/comments/167829004"},"html":{"href":"https://github.com/mgmco/handlebar-helpers/pull/1#discussion_r167829004"},"pull_request":{"href":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/1"}},"in_reply_to_id":167823777},"pull_request":{"url":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/1","id":168808463,"html_url":"https://github.com/mgmco/handlebar-helpers/pull/1","diff_url":"https://github.com/mgmco/handlebar-helpers/pull/1.diff","patch_url":"https://github.com/mgmco/handlebar-helpers/pull/1.patch","issue_url":"https://api.github.com/repos/mgmco/handlebar-helpers/issues/1","number":1,"state":"open","locked":false,"title":"Add format currency helper","user":{"login":"adriaanvanrossum","id":1079135,"avatar_url":"https://avatars3.githubusercontent.com/u/1079135?v=4","gravatar_id":"","url":"https://api.github.com/users/adriaanvanrossum","html_url":"https://github.com/adriaanvanrossum","followers_url":"https://api.github.com/users/adriaanvanrossum/followers","following_url":"https://api.github.com/users/adriaanvanrossum/following{/other_user}","gists_url":"https://api.github.com/users/adriaanvanrossum/gists{/gist_id}","starred_url":"https://api.github.com/users/adriaanvanrossum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adriaanvanrossum/subscriptions","organizations_url":"https://api.github.com/users/adriaanvanrossum/orgs","repos_url":"https://api.github.com/users/adriaanvanrossum/repos","events_url":"https://api.github.com/users/adriaanvanrossum/events{/privacy}","received_events_url":"https://api.github.com/users/adriaanvanrossum/received_events","type":"User","site_admin":false},"body":"PR from @mtimofiiv ;-) ","created_at":"2018-02-13T10:36:48Z","updated_at":"2018-02-13T10:58:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"47b7f9209a0d1093c47fa7287ba80f00debfed09","assignee":{"login":"mtimofiiv","id":428948,"avatar_url":"https://avatars2.githubusercontent.com/u/428948?v=4","gravatar_id":"","url":"https://api.github.com/users/mtimofiiv","html_url":"https://github.com/mtimofiiv","followers_url":"https://api.github.com/users/mtimofiiv/followers","following_url":"https://api.github.com/users/mtimofiiv/following{/other_user}","gists_url":"https://api.github.com/users/mtimofiiv/gists{/gist_id}","starred_url":"https://api.github.com/users/mtimofiiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtimofiiv/subscriptions","organizations_url":"https://api.github.com/users/mtimofiiv/orgs","repos_url":"https://api.github.com/users/mtimofiiv/repos","events_url":"https://api.github.com/users/mtimofiiv/events{/privacy}","received_events_url":"https://api.github.com/users/mtimofiiv/received_events","type":"User","site_admin":false},"assignees":[{"login":"mtimofiiv","id":428948,"avatar_url":"https://avatars2.githubusercontent.com/u/428948?v=4","gravatar_id":"","url":"https://api.github.com/users/mtimofiiv","html_url":"https://github.com/mtimofiiv","followers_url":"https://api.github.com/users/mtimofiiv/followers","following_url":"https://api.github.com/users/mtimofiiv/following{/other_user}","gists_url":"https://api.github.com/users/mtimofiiv/gists{/gist_id}","starred_url":"https://api.github.com/users/mtimofiiv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtimofiiv/subscriptions","organizations_url":"https://api.github.com/users/mtimofiiv/orgs","repos_url":"https://api.github.com/users/mtimofiiv/repos","events_url":"https://api.github.com/users/mtimofiiv/events{/privacy}","received_events_url":"https://api.github.com/users/mtimofiiv/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"andreamarchetti","id":25117769,"avatar_url":"https://avatars3.githubusercontent.com/u/25117769?v=4","gravatar_id":"","url":"https://api.github.com/users/andreamarchetti","html_url":"https://github.com/andreamarchetti","followers_url":"https://api.github.com/users/andreamarchetti/followers","following_url":"https://api.github.com/users/andreamarchetti/following{/other_user}","gists_url":"https://api.github.com/users/andreamarchetti/gists{/gist_id}","starred_url":"https://api.github.com/users/andreamarchetti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreamarchetti/subscriptions","organizations_url":"https://api.github.com/users/andreamarchetti/orgs","repos_url":"https://api.github.com/users/andreamarchetti/repos","events_url":"https://api.github.com/users/andreamarchetti/events{/privacy}","received_events_url":"https://api.github.com/users/andreamarchetti/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/1/commits","review_comments_url":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/1/comments","review_comment_url":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mgmco/handlebar-helpers/issues/1/comments","statuses_url":"https://api.github.com/repos/mgmco/handlebar-helpers/statuses/b9c5d1f3e43a99d586fa484e8bb2777ab203e9a3","head":{"label":"mgmco:feature/add-format-currency-helper","ref":"feature/add-format-currency-helper","sha":"b9c5d1f3e43a99d586fa484e8bb2777ab203e9a3","user":{"login":"mgmco","id":1814640,"avatar_url":"https://avatars2.githubusercontent.com/u/1814640?v=4","gravatar_id":"","url":"https://api.github.com/users/mgmco","html_url":"https://github.com/mgmco","followers_url":"https://api.github.com/users/mgmco/followers","following_url":"https://api.github.com/users/mgmco/following{/other_user}","gists_url":"https://api.github.com/users/mgmco/gists{/gist_id}","starred_url":"https://api.github.com/users/mgmco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgmco/subscriptions","organizations_url":"https://api.github.com/users/mgmco/orgs","repos_url":"https://api.github.com/users/mgmco/repos","events_url":"https://api.github.com/users/mgmco/events{/privacy}","received_events_url":"https://api.github.com/users/mgmco/received_events","type":"Organization","site_admin":false},"repo":{"id":121238861,"name":"handlebar-helpers","full_name":"mgmco/handlebar-helpers","owner":{"login":"mgmco","id":1814640,"avatar_url":"https://avatars2.githubusercontent.com/u/1814640?v=4","gravatar_id":"","url":"https://api.github.com/users/mgmco","html_url":"https://github.com/mgmco","followers_url":"https://api.github.com/users/mgmco/followers","following_url":"https://api.github.com/users/mgmco/following{/other_user}","gists_url":"https://api.github.com/users/mgmco/gists{/gist_id}","starred_url":"https://api.github.com/users/mgmco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgmco/subscriptions","organizations_url":"https://api.github.com/users/mgmco/orgs","repos_url":"https://api.github.com/users/mgmco/repos","events_url":"https://api.github.com/users/mgmco/events{/privacy}","received_events_url":"https://api.github.com/users/mgmco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mgmco/handlebar-helpers","description":"Reusable helpers to be used with Handlebars, on the server (event mails) or in a frontend app","fork":false,"url":"https://api.github.com/repos/mgmco/handlebar-helpers","forks_url":"https://api.github.com/repos/mgmco/handlebar-helpers/forks","keys_url":"https://api.github.com/repos/mgmco/handlebar-helpers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mgmco/handlebar-helpers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mgmco/handlebar-helpers/teams","hooks_url":"https://api.github.com/repos/mgmco/handlebar-helpers/hooks","issue_events_url":"https://api.github.com/repos/mgmco/handlebar-helpers/issues/events{/number}","events_url":"https://api.github.com/repos/mgmco/handlebar-helpers/events","assignees_url":"https://api.github.com/repos/mgmco/handlebar-helpers/assignees{/user}","branches_url":"https://api.github.com/repos/mgmco/handlebar-helpers/branches{/branch}","tags_url":"https://api.github.com/repos/mgmco/handlebar-helpers/tags","blobs_url":"https://api.github.com/repos/mgmco/handlebar-helpers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mgmco/handlebar-helpers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mgmco/handlebar-helpers/git/refs{/sha}","trees_url":"https://api.github.com/repos/mgmco/handlebar-helpers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mgmco/handlebar-helpers/statuses/{sha}","languages_url":"https://api.github.com/repos/mgmco/handlebar-helpers/languages","stargazers_url":"https://api.github.com/repos/mgmco/handlebar-helpers/stargazers","contributors_url":"https://api.github.com/repos/mgmco/handlebar-helpers/contributors","subscribers_url":"https://api.github.com/repos/mgmco/handlebar-helpers/subscribers","subscription_url":"https://api.github.com/repos/mgmco/handlebar-helpers/subscription","commits_url":"https://api.github.com/repos/mgmco/handlebar-helpers/commits{/sha}","git_commits_url":"https://api.github.com/repos/mgmco/handlebar-helpers/git/commits{/sha}","comments_url":"https://api.github.com/repos/mgmco/handlebar-helpers/comments{/number}","issue_comment_url":"https://api.github.com/repos/mgmco/handlebar-helpers/issues/comments{/number}","contents_url":"https://api.github.com/repos/mgmco/handlebar-helpers/contents/{+path}","compare_url":"https://api.github.com/repos/mgmco/handlebar-helpers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mgmco/handlebar-helpers/merges","archive_url":"https://api.github.com/repos/mgmco/handlebar-helpers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mgmco/handlebar-helpers/downloads","issues_url":"https://api.github.com/repos/mgmco/handlebar-helpers/issues{/number}","pulls_url":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls{/number}","milestones_url":"https://api.github.com/repos/mgmco/handlebar-helpers/milestones{/number}","notifications_url":"https://api.github.com/repos/mgmco/handlebar-helpers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mgmco/handlebar-helpers/labels{/name}","releases_url":"https://api.github.com/repos/mgmco/handlebar-helpers/releases{/id}","deployments_url":"https://api.github.com/repos/mgmco/handlebar-helpers/deployments","created_at":"2018-02-12T11:32:34Z","updated_at":"2018-02-12T14:00:22Z","pushed_at":"2018-02-13T10:58:10Z","git_url":"git://github.com/mgmco/handlebar-helpers.git","ssh_url":"git@github.com:mgmco/handlebar-helpers.git","clone_url":"https://github.com/mgmco/handlebar-helpers.git","svn_url":"https://github.com/mgmco/handlebar-helpers","homepage":"https://membergetmember.co","size":32,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"mgmco:master","ref":"master","sha":"7b30c4b8058d6a03bbf057b57528711782dfe057","user":{"login":"mgmco","id":1814640,"avatar_url":"https://avatars2.githubusercontent.com/u/1814640?v=4","gravatar_id":"","url":"https://api.github.com/users/mgmco","html_url":"https://github.com/mgmco","followers_url":"https://api.github.com/users/mgmco/followers","following_url":"https://api.github.com/users/mgmco/following{/other_user}","gists_url":"https://api.github.com/users/mgmco/gists{/gist_id}","starred_url":"https://api.github.com/users/mgmco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgmco/subscriptions","organizations_url":"https://api.github.com/users/mgmco/orgs","repos_url":"https://api.github.com/users/mgmco/repos","events_url":"https://api.github.com/users/mgmco/events{/privacy}","received_events_url":"https://api.github.com/users/mgmco/received_events","type":"Organization","site_admin":false},"repo":{"id":121238861,"name":"handlebar-helpers","full_name":"mgmco/handlebar-helpers","owner":{"login":"mgmco","id":1814640,"avatar_url":"https://avatars2.githubusercontent.com/u/1814640?v=4","gravatar_id":"","url":"https://api.github.com/users/mgmco","html_url":"https://github.com/mgmco","followers_url":"https://api.github.com/users/mgmco/followers","following_url":"https://api.github.com/users/mgmco/following{/other_user}","gists_url":"https://api.github.com/users/mgmco/gists{/gist_id}","starred_url":"https://api.github.com/users/mgmco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgmco/subscriptions","organizations_url":"https://api.github.com/users/mgmco/orgs","repos_url":"https://api.github.com/users/mgmco/repos","events_url":"https://api.github.com/users/mgmco/events{/privacy}","received_events_url":"https://api.github.com/users/mgmco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mgmco/handlebar-helpers","description":"Reusable helpers to be used with Handlebars, on the server (event mails) or in a frontend app","fork":false,"url":"https://api.github.com/repos/mgmco/handlebar-helpers","forks_url":"https://api.github.com/repos/mgmco/handlebar-helpers/forks","keys_url":"https://api.github.com/repos/mgmco/handlebar-helpers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mgmco/handlebar-helpers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mgmco/handlebar-helpers/teams","hooks_url":"https://api.github.com/repos/mgmco/handlebar-helpers/hooks","issue_events_url":"https://api.github.com/repos/mgmco/handlebar-helpers/issues/events{/number}","events_url":"https://api.github.com/repos/mgmco/handlebar-helpers/events","assignees_url":"https://api.github.com/repos/mgmco/handlebar-helpers/assignees{/user}","branches_url":"https://api.github.com/repos/mgmco/handlebar-helpers/branches{/branch}","tags_url":"https://api.github.com/repos/mgmco/handlebar-helpers/tags","blobs_url":"https://api.github.com/repos/mgmco/handlebar-helpers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mgmco/handlebar-helpers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mgmco/handlebar-helpers/git/refs{/sha}","trees_url":"https://api.github.com/repos/mgmco/handlebar-helpers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mgmco/handlebar-helpers/statuses/{sha}","languages_url":"https://api.github.com/repos/mgmco/handlebar-helpers/languages","stargazers_url":"https://api.github.com/repos/mgmco/handlebar-helpers/stargazers","contributors_url":"https://api.github.com/repos/mgmco/handlebar-helpers/contributors","subscribers_url":"https://api.github.com/repos/mgmco/handlebar-helpers/subscribers","subscription_url":"https://api.github.com/repos/mgmco/handlebar-helpers/subscription","commits_url":"https://api.github.com/repos/mgmco/handlebar-helpers/commits{/sha}","git_commits_url":"https://api.github.com/repos/mgmco/handlebar-helpers/git/commits{/sha}","comments_url":"https://api.github.com/repos/mgmco/handlebar-helpers/comments{/number}","issue_comment_url":"https://api.github.com/repos/mgmco/handlebar-helpers/issues/comments{/number}","contents_url":"https://api.github.com/repos/mgmco/handlebar-helpers/contents/{+path}","compare_url":"https://api.github.com/repos/mgmco/handlebar-helpers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mgmco/handlebar-helpers/merges","archive_url":"https://api.github.com/repos/mgmco/handlebar-helpers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mgmco/handlebar-helpers/downloads","issues_url":"https://api.github.com/repos/mgmco/handlebar-helpers/issues{/number}","pulls_url":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls{/number}","milestones_url":"https://api.github.com/repos/mgmco/handlebar-helpers/milestones{/number}","notifications_url":"https://api.github.com/repos/mgmco/handlebar-helpers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mgmco/handlebar-helpers/labels{/name}","releases_url":"https://api.github.com/repos/mgmco/handlebar-helpers/releases{/id}","deployments_url":"https://api.github.com/repos/mgmco/handlebar-helpers/deployments","created_at":"2018-02-12T11:32:34Z","updated_at":"2018-02-12T14:00:22Z","pushed_at":"2018-02-13T10:58:10Z","git_url":"git://github.com/mgmco/handlebar-helpers.git","ssh_url":"git@github.com:mgmco/handlebar-helpers.git","clone_url":"https://github.com/mgmco/handlebar-helpers.git","svn_url":"https://github.com/mgmco/handlebar-helpers","homepage":"https://membergetmember.co","size":32,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/1"},"html":{"href":"https://github.com/mgmco/handlebar-helpers/pull/1"},"issue":{"href":"https://api.github.com/repos/mgmco/handlebar-helpers/issues/1"},"comments":{"href":"https://api.github.com/repos/mgmco/handlebar-helpers/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mgmco/handlebar-helpers/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/mgmco/handlebar-helpers/statuses/b9c5d1f3e43a99d586fa484e8bb2777ab203e9a3"}},"author_association":"OWNER"}}
{"actor":{"display_login":"mtimofiiv"}}