{"action":"created","comment":{"url":"https://api.github.com/repos/pagarme/pagarme-js/pulls/comments/138993560","pull_request_review_id":62852120,"id":138993560,"diff_hunk":"@@ -1,91 +1,39 @@\n import {\n   F,\n-  T,\n-  add,\n-  and,\n-  both,\n-  cond,\n   equals,\n-  gt,\n   ifElse,\n-  length,\n-  lt,\n-  lte,\n-  merge,\n-  modulo,\n-  pipe,\n-  prop,\n   replace,\n   splitEvery,\n   toString,\n-  zipObj,\n+  propSatisfies,\n+  map,\n } from 'ramda'\n \n const clean = replace(/[^0-9]/g, '')\n \n const getCurrentDate = () => {\n-  const date = new Date()\n-\n+  const now = new Date()","path":"lib/validations/validate/card/date.js","position":31,"original_position":31,"commit_id":"5ca94f01bffec8ef031cba13a3140c0931233e56","original_commit_id":"5ca94f01bffec8ef031cba13a3140c0931233e56","user":{"login":"thalesmello","id":1127394,"avatar_url":"https://avatars3.githubusercontent.com/u/1127394?v=4","gravatar_id":"","url":"https://api.github.com/users/thalesmello","html_url":"https://github.com/thalesmello","followers_url":"https://api.github.com/users/thalesmello/followers","following_url":"https://api.github.com/users/thalesmello/following{/other_user}","gists_url":"https://api.github.com/users/thalesmello/gists{/gist_id}","starred_url":"https://api.github.com/users/thalesmello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thalesmello/subscriptions","organizations_url":"https://api.github.com/users/thalesmello/orgs","repos_url":"https://api.github.com/users/thalesmello/repos","events_url":"https://api.github.com/users/thalesmello/events{/privacy}","received_events_url":"https://api.github.com/users/thalesmello/received_events","type":"User","site_admin":false},"body":"✨ ","created_at":"2017-09-14T19:48:19Z","updated_at":"2017-09-14T19:59:41Z","html_url":"https://github.com/pagarme/pagarme-js/pull/86#discussion_r138993560","pull_request_url":"https://api.github.com/repos/pagarme/pagarme-js/pulls/86","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/pagarme/pagarme-js/pulls/comments/138993560"},"html":{"href":"https://github.com/pagarme/pagarme-js/pull/86#discussion_r138993560"},"pull_request":{"href":"https://api.github.com/repos/pagarme/pagarme-js/pulls/86"}}},"pull_request":{"url":"https://api.github.com/repos/pagarme/pagarme-js/pulls/86","id":141141033,"html_url":"https://github.com/pagarme/pagarme-js/pull/86","diff_url":"https://github.com/pagarme/pagarme-js/pull/86.diff","patch_url":"https://github.com/pagarme/pagarme-js/pull/86.patch","issue_url":"https://api.github.com/repos/pagarme/pagarme-js/issues/86","number":86,"state":"open","locked":false,"title":"Make the world functional again","user":{"login":"haskellcamargo","id":7553006,"avatar_url":"https://avatars0.githubusercontent.com/u/7553006?v=4","gravatar_id":"","url":"https://api.github.com/users/haskellcamargo","html_url":"https://github.com/haskellcamargo","followers_url":"https://api.github.com/users/haskellcamargo/followers","following_url":"https://api.github.com/users/haskellcamargo/following{/other_user}","gists_url":"https://api.github.com/users/haskellcamargo/gists{/gist_id}","starred_url":"https://api.github.com/users/haskellcamargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haskellcamargo/subscriptions","organizations_url":"https://api.github.com/users/haskellcamargo/orgs","repos_url":"https://api.github.com/users/haskellcamargo/repos","events_url":"https://api.github.com/users/haskellcamargo/events{/privacy}","received_events_url":"https://api.github.com/users/haskellcamargo/received_events","type":"User","site_admin":false},"body":"This pull-request aims to improve code quality by refactoring some functions and modules and using point-free programming and combinatory logic concepts\r\n\r\n> TLDR: No flamewars, please. Keep a health discussion\r\n\r\n![The Functional Way](https://pbs.twimg.com/media/B7RKsQhIgAAmYd5.jpg)\r\n\r\n## New packages\r\n\r\n### Bundle\r\n\r\n- `y-combinator@1.0.0`\r\n\r\n### Development\r\n\r\n- `babel-plugin-function-composition@0.1.1`\r\n- `babel-plugin-implicit-function@0.1.1`\r\n- `babel-plugin-pipe-operator-curry@1.0.2`\r\n\r\n## Added operators\r\n\r\n### Implicit function\r\n\r\nThe `~` operator is overloaded for lazy and implicit function definition. It is exactly a lazy version of `always` (bug-free), where `~1` is equivalent to `() => 1`. It can be also called as the `K` combinator and improves expressiveness\r\n\r\n### Pipe operator curry\r\n\r\nThe `|` operator is overloaded to work with **values**, where `a | b | c` is **exactly** the same as `c(b(a))`. It can be represented as the `T` combinator and avoids workarounds on the code, like using `)(` to immediatelly invoke a `pipe`, an `ifElse` or a `cond`.\r\n\r\n### Function composition\r\n\r\nThe `&` operator does pipe composition. Not to be confused with `|`. Unlike `|`, `&` works for **functions** and **return functions**. `a & b & c` is equivalent to `pipe(a, b, c)`, returning a function to continue the computation. For example, A function `const arithmetic = value => value | add(10) | multiply(2)` could be written as `const arithmetic = add(10) & multiply(2)`, using tacit, point-free programming. It can be compared to the `Q` combinator (inverse composition).\r\n\r\n## Relevant changes\r\n\r\n- Edit `README.md` to fix example code, that was error-prone\r\n- `lib/client/index.js`\r\n    - Replace `isFunction` by Ramda `is(Function)`\r\n    - Replace explicit recursion by point-free anonymous recursion with Y combinator\r\n- `lib/client/strategies/encryption.js`\r\n    - Remove mutability from everywhere\r\n    - Remove every `if` and `throw` and use function chaining\r\n- `lib/index.js`\r\n    - Change `Object.assign` by `merge`, because there is only one usage of that\r\n- `lib/request.js`\r\n    - Change imperative structures by point-free ones\r\n- `lib/resources/security.js`\r\n    - Simplify piping\r\n- `lib/validations/validate/card/cardNumber.js`\r\n    - Pray to God, because there was a lot of dead and unnecessary code for a simple logic\r\n    - Use simple combinators to make things more simple\r\n    - Remove de-abstraction by constants (code smell)\r\n    - Remove **any sort of mutability**\r\n- `lib/validations/validate/card/date.js`\r\n    - The expression alternative was better than the _reinvent the wheel_ one\r\n    - I've killed almost everything. The logic was pretty simple, but the code was very complex\r\n- `lib/validations/validate/card/holder.js`, `lib/validations/validate/card/month.js`, `lib/validations/validate/numberSize.js`\r\n    - Use inverse composition, also called piping\r\n- `lib/validations/validate/card/year.js`\r\n    - More expressive way to get length\r\n- `test/echoServer/index.js`\r\n    - Avoid IIFE\r\n- `test/echoServer/parsers.js`\r\n    - Rewrite everything using functional programming. Before, was imperative with Ramda\r\n\r\n## Remaining work\r\n\r\n- [ ] Check linter rules to allow bitwise operations, if the new operators get approved\r\n- [ ] @MarcoWorms proposed to rebase my commits with GitCop standard\r\n- [ ] Regenerate or restore the compiled files that were not up to date, but still tracked\r\n- [ ] Talk about `bundledDependencies` instead of `devDependencies` for things that go to the bundle","created_at":"2017-09-14T18:06:39Z","updated_at":"2017-09-14T19:59:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe52ba5ba6faea1230851db5f4b4f2daf23ebc32","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/pagarme/pagarme-js/pulls/86/commits","review_comments_url":"https://api.github.com/repos/pagarme/pagarme-js/pulls/86/comments","review_comment_url":"https://api.github.com/repos/pagarme/pagarme-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pagarme/pagarme-js/issues/86/comments","statuses_url":"https://api.github.com/repos/pagarme/pagarme-js/statuses/5ca94f01bffec8ef031cba13a3140c0931233e56","head":{"label":"haskellcamargo:make-the-world-functional-again","ref":"make-the-world-functional-again","sha":"5ca94f01bffec8ef031cba13a3140c0931233e56","user":{"login":"haskellcamargo","id":7553006,"avatar_url":"https://avatars0.githubusercontent.com/u/7553006?v=4","gravatar_id":"","url":"https://api.github.com/users/haskellcamargo","html_url":"https://github.com/haskellcamargo","followers_url":"https://api.github.com/users/haskellcamargo/followers","following_url":"https://api.github.com/users/haskellcamargo/following{/other_user}","gists_url":"https://api.github.com/users/haskellcamargo/gists{/gist_id}","starred_url":"https://api.github.com/users/haskellcamargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haskellcamargo/subscriptions","organizations_url":"https://api.github.com/users/haskellcamargo/orgs","repos_url":"https://api.github.com/users/haskellcamargo/repos","events_url":"https://api.github.com/users/haskellcamargo/events{/privacy}","received_events_url":"https://api.github.com/users/haskellcamargo/received_events","type":"User","site_admin":false},"repo":{"id":103154709,"name":"pagarme-js","full_name":"haskellcamargo/pagarme-js","owner":{"login":"haskellcamargo","id":7553006,"avatar_url":"https://avatars0.githubusercontent.com/u/7553006?v=4","gravatar_id":"","url":"https://api.github.com/users/haskellcamargo","html_url":"https://github.com/haskellcamargo","followers_url":"https://api.github.com/users/haskellcamargo/followers","following_url":"https://api.github.com/users/haskellcamargo/following{/other_user}","gists_url":"https://api.github.com/users/haskellcamargo/gists{/gist_id}","starred_url":"https://api.github.com/users/haskellcamargo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haskellcamargo/subscriptions","organizations_url":"https://api.github.com/users/haskellcamargo/orgs","repos_url":"https://api.github.com/users/haskellcamargo/repos","events_url":"https://api.github.com/users/haskellcamargo/events{/privacy}","received_events_url":"https://api.github.com/users/haskellcamargo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haskellcamargo/pagarme-js","description":"💛 Pagar.me's Javascript API","fork":true,"url":"https://api.github.com/repos/haskellcamargo/pagarme-js","forks_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/forks","keys_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/teams","hooks_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/hooks","issue_events_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/issues/events{/number}","events_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/events","assignees_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/assignees{/user}","branches_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/branches{/branch}","tags_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/tags","blobs_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/statuses/{sha}","languages_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/languages","stargazers_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/stargazers","contributors_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/contributors","subscribers_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/subscribers","subscription_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/subscription","commits_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/contents/{+path}","compare_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/merges","archive_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/downloads","issues_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/issues{/number}","pulls_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/pulls{/number}","milestones_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/milestones{/number}","notifications_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/labels{/name}","releases_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/releases{/id}","deployments_url":"https://api.github.com/repos/haskellcamargo/pagarme-js/deployments","created_at":"2017-09-11T15:39:50Z","updated_at":"2017-09-11T15:39:51Z","pushed_at":"2017-09-14T05:20:13Z","git_url":"git://github.com/haskellcamargo/pagarme-js.git","ssh_url":"git@github.com:haskellcamargo/pagarme-js.git","clone_url":"https://github.com/haskellcamargo/pagarme-js.git","svn_url":"https://github.com/haskellcamargo/pagarme-js","homepage":"","size":7295,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pagarme:master","ref":"master","sha":"74dd44aba2a32df6cc3d7ea6fe7f51da6bcacd27","user":{"login":"pagarme","id":3846050,"avatar_url":"https://avatars2.githubusercontent.com/u/3846050?v=4","gravatar_id":"","url":"https://api.github.com/users/pagarme","html_url":"https://github.com/pagarme","followers_url":"https://api.github.com/users/pagarme/followers","following_url":"https://api.github.com/users/pagarme/following{/other_user}","gists_url":"https://api.github.com/users/pagarme/gists{/gist_id}","starred_url":"https://api.github.com/users/pagarme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pagarme/subscriptions","organizations_url":"https://api.github.com/users/pagarme/orgs","repos_url":"https://api.github.com/users/pagarme/repos","events_url":"https://api.github.com/users/pagarme/events{/privacy}","received_events_url":"https://api.github.com/users/pagarme/received_events","type":"Organization","site_admin":false},"repo":{"id":9228919,"name":"pagarme-js","full_name":"pagarme/pagarme-js","owner":{"login":"pagarme","id":3846050,"avatar_url":"https://avatars2.githubusercontent.com/u/3846050?v=4","gravatar_id":"","url":"https://api.github.com/users/pagarme","html_url":"https://github.com/pagarme","followers_url":"https://api.github.com/users/pagarme/followers","following_url":"https://api.github.com/users/pagarme/following{/other_user}","gists_url":"https://api.github.com/users/pagarme/gists{/gist_id}","starred_url":"https://api.github.com/users/pagarme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pagarme/subscriptions","organizations_url":"https://api.github.com/users/pagarme/orgs","repos_url":"https://api.github.com/users/pagarme/repos","events_url":"https://api.github.com/users/pagarme/events{/privacy}","received_events_url":"https://api.github.com/users/pagarme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pagarme/pagarme-js","description":"💛 Pagar.me's Javascript API","fork":false,"url":"https://api.github.com/repos/pagarme/pagarme-js","forks_url":"https://api.github.com/repos/pagarme/pagarme-js/forks","keys_url":"https://api.github.com/repos/pagarme/pagarme-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pagarme/pagarme-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pagarme/pagarme-js/teams","hooks_url":"https://api.github.com/repos/pagarme/pagarme-js/hooks","issue_events_url":"https://api.github.com/repos/pagarme/pagarme-js/issues/events{/number}","events_url":"https://api.github.com/repos/pagarme/pagarme-js/events","assignees_url":"https://api.github.com/repos/pagarme/pagarme-js/assignees{/user}","branches_url":"https://api.github.com/repos/pagarme/pagarme-js/branches{/branch}","tags_url":"https://api.github.com/repos/pagarme/pagarme-js/tags","blobs_url":"https://api.github.com/repos/pagarme/pagarme-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pagarme/pagarme-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pagarme/pagarme-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/pagarme/pagarme-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pagarme/pagarme-js/statuses/{sha}","languages_url":"https://api.github.com/repos/pagarme/pagarme-js/languages","stargazers_url":"https://api.github.com/repos/pagarme/pagarme-js/stargazers","contributors_url":"https://api.github.com/repos/pagarme/pagarme-js/contributors","subscribers_url":"https://api.github.com/repos/pagarme/pagarme-js/subscribers","subscription_url":"https://api.github.com/repos/pagarme/pagarme-js/subscription","commits_url":"https://api.github.com/repos/pagarme/pagarme-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/pagarme/pagarme-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/pagarme/pagarme-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/pagarme/pagarme-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/pagarme/pagarme-js/contents/{+path}","compare_url":"https://api.github.com/repos/pagarme/pagarme-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pagarme/pagarme-js/merges","archive_url":"https://api.github.com/repos/pagarme/pagarme-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pagarme/pagarme-js/downloads","issues_url":"https://api.github.com/repos/pagarme/pagarme-js/issues{/number}","pulls_url":"https://api.github.com/repos/pagarme/pagarme-js/pulls{/number}","milestones_url":"https://api.github.com/repos/pagarme/pagarme-js/milestones{/number}","notifications_url":"https://api.github.com/repos/pagarme/pagarme-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pagarme/pagarme-js/labels{/name}","releases_url":"https://api.github.com/repos/pagarme/pagarme-js/releases{/id}","deployments_url":"https://api.github.com/repos/pagarme/pagarme-js/deployments","created_at":"2013-04-04T21:56:13Z","updated_at":"2017-09-02T23:40:40Z","pushed_at":"2017-09-14T18:06:40Z","git_url":"git://github.com/pagarme/pagarme-js.git","ssh_url":"git@github.com:pagarme/pagarme-js.git","clone_url":"https://github.com/pagarme/pagarme-js.git","svn_url":"https://github.com/pagarme/pagarme-js","homepage":"","size":7168,"stargazers_count":147,"watchers_count":147,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":26,"mirror_url":null,"open_issues_count":11,"forks":26,"open_issues":11,"watchers":147,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pagarme/pagarme-js/pulls/86"},"html":{"href":"https://github.com/pagarme/pagarme-js/pull/86"},"issue":{"href":"https://api.github.com/repos/pagarme/pagarme-js/issues/86"},"comments":{"href":"https://api.github.com/repos/pagarme/pagarme-js/issues/86/comments"},"review_comments":{"href":"https://api.github.com/repos/pagarme/pagarme-js/pulls/86/comments"},"review_comment":{"href":"https://api.github.com/repos/pagarme/pagarme-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pagarme/pagarme-js/pulls/86/commits"},"statuses":{"href":"https://api.github.com/repos/pagarme/pagarme-js/statuses/5ca94f01bffec8ef031cba13a3140c0931233e56"}},"author_association":"NONE"}}
{"actor":{"display_login":"thalesmello"}}