{"action":"created","comment":{"url":"https://api.github.com/repos/ramda/ramda/pulls/comments/33897080","id":33897080,"diff_hunk":"@@ -1,21 +1,38 @@\n var _curry1 = require('./internal/_curry1');\n-var _hasMethod = require('./internal/_hasMethod');\n \n \n /**\n- * `empty` returns an empty list for any argument, except when the argument satisfies the\n- * Fantasy-land Monoid spec. In that case, this function will return the result of invoking\n- * `empty` on that Monoid.\n+ * Returns the empty value of its argument's type. The argument must be a\n+ * [Monoid](https://github.com/fantasyland/fantasy-land#monoid), Array,\n+ * Object, or String.\n  *\n  * @func\n  * @memberOf R\n  * @category Function\n- * @sig * -> []\n- * @return {Array} An empty array.\n+ * @sig Monoid m => m a -> m a\n+ * @param {*} x\n+ * @return {*}\n  * @example\n  *\n- *      R.empty([1,2,3,4,5]); //=> []\n+ *      R.empty(Just(42));      //=> Nothing()\n+ *      R.empty([1, 2, 3]);     //=> []\n+ *      R.empty('unicorns');    //=> ''\n+ *      R.empty({x: 1, y: 2});  //=> {}\n  */\n module.exports = _curry1(function empty(x) {\n-  return _hasMethod('empty', x) ? x.empty() : [];\n+  var repr = Object.prototype.toString.call(x);\n+  return (\n+    x != null && typeof x.empty === 'function' ?\n+      x.empty() :\n+    x != null && typeof x.constructor != null && typeof x.constructor.empty === 'function' ?\n+      x.constructor.empty() :\n+    repr === '[object Array]' ?\n+      [] :\n+    repr === '[object Object]' ?\n+      {} :\n+    repr === '[object String]' ?\n+      '' :\n+    // else\n+      void 0\n+  );\n });","path":"src/empty.js","position":46,"original_position":46,"commit_id":"543419289ba44a4eadcd030a441d912df2c74e6b","original_commit_id":"543419289ba44a4eadcd030a441d912df2c74e6b","user":{"login":"CrossEye","id":151263,"avatar_url":"https://avatars.githubusercontent.com/u/151263?v=3","gravatar_id":"","url":"https://api.github.com/users/CrossEye","html_url":"https://github.com/CrossEye","followers_url":"https://api.github.com/users/CrossEye/followers","following_url":"https://api.github.com/users/CrossEye/following{/other_user}","gists_url":"https://api.github.com/users/CrossEye/gists{/gist_id}","starred_url":"https://api.github.com/users/CrossEye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrossEye/subscriptions","organizations_url":"https://api.github.com/users/CrossEye/orgs","repos_url":"https://api.github.com/users/CrossEye/repos","events_url":"https://api.github.com/users/CrossEye/events{/privacy}","received_events_url":"https://api.github.com/users/CrossEye/received_events","type":"User","site_admin":false},"body":":+1:","created_at":"2015-07-05T17:58:52Z","updated_at":"2015-07-05T17:58:52Z","html_url":"https://github.com/ramda/ramda/pull/1236#discussion_r33897080","pull_request_url":"https://api.github.com/repos/ramda/ramda/pulls/1236","_links":{"self":{"href":"https://api.github.com/repos/ramda/ramda/pulls/comments/33897080"},"html":{"href":"https://github.com/ramda/ramda/pull/1236#discussion_r33897080"},"pull_request":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1236"}}},"pull_request":{"url":"https://api.github.com/repos/ramda/ramda/pulls/1236","id":38831927,"html_url":"https://github.com/ramda/ramda/pull/1236","diff_url":"https://github.com/ramda/ramda/pull/1236.diff","patch_url":"https://github.com/ramda/ramda/pull/1236.patch","issue_url":"https://api.github.com/repos/ramda/ramda/issues/1236","number":1236,"state":"open","locked":false,"title":"define R.empty for Object and String","user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars.githubusercontent.com/u/210406?v=3","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"body":"As suggested by @scott-christopher and @paldepind in #1228\r\n","created_at":"2015-06-30T00:24:43Z","updated_at":"2015-07-05T17:58:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d07e3e618e58f3cfe7464c59140e78ccb498cb91","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ramda/ramda/pulls/1236/commits","review_comments_url":"https://api.github.com/repos/ramda/ramda/pulls/1236/comments","review_comment_url":"https://api.github.com/repos/ramda/ramda/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ramda/ramda/issues/1236/comments","statuses_url":"https://api.github.com/repos/ramda/ramda/statuses/543419289ba44a4eadcd030a441d912df2c74e6b","head":{"label":"davidchambers:empty","ref":"empty","sha":"543419289ba44a4eadcd030a441d912df2c74e6b","user":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars.githubusercontent.com/u/210406?v=3","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"repo":{"id":22492045,"name":"ramda","full_name":"davidchambers/ramda","owner":{"login":"davidchambers","id":210406,"avatar_url":"https://avatars.githubusercontent.com/u/210406?v=3","gravatar_id":"","url":"https://api.github.com/users/davidchambers","html_url":"https://github.com/davidchambers","followers_url":"https://api.github.com/users/davidchambers/followers","following_url":"https://api.github.com/users/davidchambers/following{/other_user}","gists_url":"https://api.github.com/users/davidchambers/gists{/gist_id}","starred_url":"https://api.github.com/users/davidchambers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidchambers/subscriptions","organizations_url":"https://api.github.com/users/davidchambers/orgs","repos_url":"https://api.github.com/users/davidchambers/repos","events_url":"https://api.github.com/users/davidchambers/events{/privacy}","received_events_url":"https://api.github.com/users/davidchambers/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/davidchambers/ramda","description":"","fork":true,"url":"https://api.github.com/repos/davidchambers/ramda","forks_url":"https://api.github.com/repos/davidchambers/ramda/forks","keys_url":"https://api.github.com/repos/davidchambers/ramda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davidchambers/ramda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davidchambers/ramda/teams","hooks_url":"https://api.github.com/repos/davidchambers/ramda/hooks","issue_events_url":"https://api.github.com/repos/davidchambers/ramda/issues/events{/number}","events_url":"https://api.github.com/repos/davidchambers/ramda/events","assignees_url":"https://api.github.com/repos/davidchambers/ramda/assignees{/user}","branches_url":"https://api.github.com/repos/davidchambers/ramda/branches{/branch}","tags_url":"https://api.github.com/repos/davidchambers/ramda/tags","blobs_url":"https://api.github.com/repos/davidchambers/ramda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davidchambers/ramda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davidchambers/ramda/git/refs{/sha}","trees_url":"https://api.github.com/repos/davidchambers/ramda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davidchambers/ramda/statuses/{sha}","languages_url":"https://api.github.com/repos/davidchambers/ramda/languages","stargazers_url":"https://api.github.com/repos/davidchambers/ramda/stargazers","contributors_url":"https://api.github.com/repos/davidchambers/ramda/contributors","subscribers_url":"https://api.github.com/repos/davidchambers/ramda/subscribers","subscription_url":"https://api.github.com/repos/davidchambers/ramda/subscription","commits_url":"https://api.github.com/repos/davidchambers/ramda/commits{/sha}","git_commits_url":"https://api.github.com/repos/davidchambers/ramda/git/commits{/sha}","comments_url":"https://api.github.com/repos/davidchambers/ramda/comments{/number}","issue_comment_url":"https://api.github.com/repos/davidchambers/ramda/issues/comments{/number}","contents_url":"https://api.github.com/repos/davidchambers/ramda/contents/{+path}","compare_url":"https://api.github.com/repos/davidchambers/ramda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davidchambers/ramda/merges","archive_url":"https://api.github.com/repos/davidchambers/ramda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davidchambers/ramda/downloads","issues_url":"https://api.github.com/repos/davidchambers/ramda/issues{/number}","pulls_url":"https://api.github.com/repos/davidchambers/ramda/pulls{/number}","milestones_url":"https://api.github.com/repos/davidchambers/ramda/milestones{/number}","notifications_url":"https://api.github.com/repos/davidchambers/ramda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davidchambers/ramda/labels{/name}","releases_url":"https://api.github.com/repos/davidchambers/ramda/releases{/id}","created_at":"2014-08-01T01:56:04Z","updated_at":"2015-04-24T05:09:49Z","pushed_at":"2015-07-01T00:37:56Z","git_url":"git://github.com/davidchambers/ramda.git","ssh_url":"git@github.com:davidchambers/ramda.git","clone_url":"https://github.com/davidchambers/ramda.git","svn_url":"https://github.com/davidchambers/ramda","homepage":null,"size":6857,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ramda:master","ref":"master","sha":"14d26f3336f3e70d9d0a28e4fd9457f673d9e57a","user":{"login":"ramda","id":5298359,"avatar_url":"https://avatars.githubusercontent.com/u/5298359?v=3","gravatar_id":"","url":"https://api.github.com/users/ramda","html_url":"https://github.com/ramda","followers_url":"https://api.github.com/users/ramda/followers","following_url":"https://api.github.com/users/ramda/following{/other_user}","gists_url":"https://api.github.com/users/ramda/gists{/gist_id}","starred_url":"https://api.github.com/users/ramda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramda/subscriptions","organizations_url":"https://api.github.com/users/ramda/orgs","repos_url":"https://api.github.com/users/ramda/repos","events_url":"https://api.github.com/users/ramda/events{/privacy}","received_events_url":"https://api.github.com/users/ramda/received_events","type":"Organization","site_admin":false},"repo":{"id":10851820,"name":"ramda","full_name":"ramda/ramda","owner":{"login":"ramda","id":5298359,"avatar_url":"https://avatars.githubusercontent.com/u/5298359?v=3","gravatar_id":"","url":"https://api.github.com/users/ramda","html_url":"https://github.com/ramda","followers_url":"https://api.github.com/users/ramda/followers","following_url":"https://api.github.com/users/ramda/following{/other_user}","gists_url":"https://api.github.com/users/ramda/gists{/gist_id}","starred_url":"https://api.github.com/users/ramda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramda/subscriptions","organizations_url":"https://api.github.com/users/ramda/orgs","repos_url":"https://api.github.com/users/ramda/repos","events_url":"https://api.github.com/users/ramda/events{/privacy}","received_events_url":"https://api.github.com/users/ramda/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ramda/ramda","description":":ram: Practical functional Javascript","fork":false,"url":"https://api.github.com/repos/ramda/ramda","forks_url":"https://api.github.com/repos/ramda/ramda/forks","keys_url":"https://api.github.com/repos/ramda/ramda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ramda/ramda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ramda/ramda/teams","hooks_url":"https://api.github.com/repos/ramda/ramda/hooks","issue_events_url":"https://api.github.com/repos/ramda/ramda/issues/events{/number}","events_url":"https://api.github.com/repos/ramda/ramda/events","assignees_url":"https://api.github.com/repos/ramda/ramda/assignees{/user}","branches_url":"https://api.github.com/repos/ramda/ramda/branches{/branch}","tags_url":"https://api.github.com/repos/ramda/ramda/tags","blobs_url":"https://api.github.com/repos/ramda/ramda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ramda/ramda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ramda/ramda/git/refs{/sha}","trees_url":"https://api.github.com/repos/ramda/ramda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ramda/ramda/statuses/{sha}","languages_url":"https://api.github.com/repos/ramda/ramda/languages","stargazers_url":"https://api.github.com/repos/ramda/ramda/stargazers","contributors_url":"https://api.github.com/repos/ramda/ramda/contributors","subscribers_url":"https://api.github.com/repos/ramda/ramda/subscribers","subscription_url":"https://api.github.com/repos/ramda/ramda/subscription","commits_url":"https://api.github.com/repos/ramda/ramda/commits{/sha}","git_commits_url":"https://api.github.com/repos/ramda/ramda/git/commits{/sha}","comments_url":"https://api.github.com/repos/ramda/ramda/comments{/number}","issue_comment_url":"https://api.github.com/repos/ramda/ramda/issues/comments{/number}","contents_url":"https://api.github.com/repos/ramda/ramda/contents/{+path}","compare_url":"https://api.github.com/repos/ramda/ramda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ramda/ramda/merges","archive_url":"https://api.github.com/repos/ramda/ramda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ramda/ramda/downloads","issues_url":"https://api.github.com/repos/ramda/ramda/issues{/number}","pulls_url":"https://api.github.com/repos/ramda/ramda/pulls{/number}","milestones_url":"https://api.github.com/repos/ramda/ramda/milestones{/number}","notifications_url":"https://api.github.com/repos/ramda/ramda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ramda/ramda/labels{/name}","releases_url":"https://api.github.com/repos/ramda/ramda/releases{/id}","created_at":"2013-06-21T20:32:35Z","updated_at":"2015-07-05T07:29:44Z","pushed_at":"2015-07-04T23:24:23Z","git_url":"git://github.com/ramda/ramda.git","ssh_url":"git@github.com:ramda/ramda.git","clone_url":"https://github.com/ramda/ramda.git","svn_url":"https://github.com/ramda/ramda","homepage":"http://ramdajs.com","size":10917,"stargazers_count":2310,"watchers_count":2310,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":180,"mirror_url":null,"open_issues_count":59,"forks":180,"open_issues":59,"watchers":2310,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1236"},"html":{"href":"https://github.com/ramda/ramda/pull/1236"},"issue":{"href":"https://api.github.com/repos/ramda/ramda/issues/1236"},"comments":{"href":"https://api.github.com/repos/ramda/ramda/issues/1236/comments"},"review_comments":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1236/comments"},"review_comment":{"href":"https://api.github.com/repos/ramda/ramda/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1236/commits"},"statuses":{"href":"https://api.github.com/repos/ramda/ramda/statuses/543419289ba44a4eadcd030a441d912df2c74e6b"}}}}