{"action":"created","comment":{"url":"https://api.github.com/repos/ramda/ramda/pulls/comments/46994694","id":46994694,"diff_hunk":"@@ -0,0 +1,23 @@\n+var _curry2 = require('./internal/_curry2');\n+var complement = require('./complement');\n+var dropWhile = require('./dropWhile');\n+var takeWhile = require('./takeWhile');\n+\n+\n+/**\n+ * Splits a given list at the first occurance of a satisfied predicate.\n+ *\n+ * @func\n+ * @memberOf R\n+ * @category List\n+ * @sig (a -> Boolean) -> [a] -> [[a], [a]]\n+ * @param {Function} pred The predicate that determines where the array is split.\n+ * @param {Array} list The array to be split.\n+ * @return {Array}\n+ * @example\n+ *\n+ *      R.splitWhen(R.equals(2), [1, 2, 3, 1, 2, 3]);   //=> [[1], [2, 3, 1, 2, 3]]\n+ */\n+module.exports = _curry2(function splitWhen(pred, list) {\n+  return [takeWhile(complement(pred), list), dropWhile(complement(pred), list)];\n+});","path":"src/splitWhen.js","position":27,"original_position":23,"commit_id":"fe505ceeff335b7fa354fc8569fc060985540f54","original_commit_id":"53d310435f1ae333d09f00413c8397c601bd1b32","user":{"login":"miwillhite","id":81757,"avatar_url":"https://avatars.githubusercontent.com/u/81757?v=3","gravatar_id":"","url":"https://api.github.com/users/miwillhite","html_url":"https://github.com/miwillhite","followers_url":"https://api.github.com/users/miwillhite/followers","following_url":"https://api.github.com/users/miwillhite/following{/other_user}","gists_url":"https://api.github.com/users/miwillhite/gists{/gist_id}","starred_url":"https://api.github.com/users/miwillhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miwillhite/subscriptions","organizations_url":"https://api.github.com/users/miwillhite/orgs","repos_url":"https://api.github.com/users/miwillhite/repos","events_url":"https://api.github.com/users/miwillhite/events{/privacy}","received_events_url":"https://api.github.com/users/miwillhite/received_events","type":"User","site_admin":false},"body":"A first draft imperative implementation:\r\n```\r\nmodule.exports = _curry2(function splitWhen(pred, list) {\r\n  var idx = 0, len = list.length, prefix = [];\r\n\r\n  while (idx < len && !pred(list[idx])) {\r\n    prefix.push(list[idx]);\r\n    idx += 1;\r\n  }\r\n\r\n  return [prefix, _slice(list, idx)];\r\n});\r\n```","created_at":"2015-12-08T18:44:19Z","updated_at":"2015-12-08T18:44:19Z","html_url":"https://github.com/ramda/ramda/pull/1525#discussion_r46994694","pull_request_url":"https://api.github.com/repos/ramda/ramda/pulls/1525","_links":{"self":{"href":"https://api.github.com/repos/ramda/ramda/pulls/comments/46994694"},"html":{"href":"https://github.com/ramda/ramda/pull/1525#discussion_r46994694"},"pull_request":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1525"}}},"pull_request":{"url":"https://api.github.com/repos/ramda/ramda/pulls/1525","id":51176652,"html_url":"https://github.com/ramda/ramda/pull/1525","diff_url":"https://github.com/ramda/ramda/pull/1525.diff","patch_url":"https://github.com/ramda/ramda/pull/1525.patch","issue_url":"https://api.github.com/repos/ramda/ramda/issues/1525","number":1525,"state":"open","locked":false,"title":"Add splitWhen function","user":{"login":"miwillhite","id":81757,"avatar_url":"https://avatars.githubusercontent.com/u/81757?v=3","gravatar_id":"","url":"https://api.github.com/users/miwillhite","html_url":"https://github.com/miwillhite","followers_url":"https://api.github.com/users/miwillhite/followers","following_url":"https://api.github.com/users/miwillhite/following{/other_user}","gists_url":"https://api.github.com/users/miwillhite/gists{/gist_id}","starred_url":"https://api.github.com/users/miwillhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miwillhite/subscriptions","organizations_url":"https://api.github.com/users/miwillhite/orgs","repos_url":"https://api.github.com/users/miwillhite/repos","events_url":"https://api.github.com/users/miwillhite/events{/privacy}","received_events_url":"https://api.github.com/users/miwillhite/received_events","type":"User","site_admin":false},"body":"Inspired by Haskell's `break`:\r\nhttp://hackage.haskell.org/package/base-4.8.1.0/docs/Prelude.html#v:break\r\n\r\n`R.splitWhen(R.equals(2), [1, 2, 3]);   //=> [[1], [2, 3]]`","created_at":"2015-11-19T03:41:50Z","updated_at":"2015-12-08T18:44:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d15f0a1c3f86b8ec6e87f57ef6ffdf21e50a2339","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ramda/ramda/pulls/1525/commits","review_comments_url":"https://api.github.com/repos/ramda/ramda/pulls/1525/comments","review_comment_url":"https://api.github.com/repos/ramda/ramda/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ramda/ramda/issues/1525/comments","statuses_url":"https://api.github.com/repos/ramda/ramda/statuses/fe505ceeff335b7fa354fc8569fc060985540f54","head":{"label":"miwillhite:feature/splitBy","ref":"feature/splitBy","sha":"fe505ceeff335b7fa354fc8569fc060985540f54","user":{"login":"miwillhite","id":81757,"avatar_url":"https://avatars.githubusercontent.com/u/81757?v=3","gravatar_id":"","url":"https://api.github.com/users/miwillhite","html_url":"https://github.com/miwillhite","followers_url":"https://api.github.com/users/miwillhite/followers","following_url":"https://api.github.com/users/miwillhite/following{/other_user}","gists_url":"https://api.github.com/users/miwillhite/gists{/gist_id}","starred_url":"https://api.github.com/users/miwillhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miwillhite/subscriptions","organizations_url":"https://api.github.com/users/miwillhite/orgs","repos_url":"https://api.github.com/users/miwillhite/repos","events_url":"https://api.github.com/users/miwillhite/events{/privacy}","received_events_url":"https://api.github.com/users/miwillhite/received_events","type":"User","site_admin":false},"repo":{"id":46464412,"name":"ramda","full_name":"miwillhite/ramda","owner":{"login":"miwillhite","id":81757,"avatar_url":"https://avatars.githubusercontent.com/u/81757?v=3","gravatar_id":"","url":"https://api.github.com/users/miwillhite","html_url":"https://github.com/miwillhite","followers_url":"https://api.github.com/users/miwillhite/followers","following_url":"https://api.github.com/users/miwillhite/following{/other_user}","gists_url":"https://api.github.com/users/miwillhite/gists{/gist_id}","starred_url":"https://api.github.com/users/miwillhite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miwillhite/subscriptions","organizations_url":"https://api.github.com/users/miwillhite/orgs","repos_url":"https://api.github.com/users/miwillhite/repos","events_url":"https://api.github.com/users/miwillhite/events{/privacy}","received_events_url":"https://api.github.com/users/miwillhite/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/miwillhite/ramda","description":":ram: Practical functional Javascript","fork":true,"url":"https://api.github.com/repos/miwillhite/ramda","forks_url":"https://api.github.com/repos/miwillhite/ramda/forks","keys_url":"https://api.github.com/repos/miwillhite/ramda/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miwillhite/ramda/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miwillhite/ramda/teams","hooks_url":"https://api.github.com/repos/miwillhite/ramda/hooks","issue_events_url":"https://api.github.com/repos/miwillhite/ramda/issues/events{/number}","events_url":"https://api.github.com/repos/miwillhite/ramda/events","assignees_url":"https://api.github.com/repos/miwillhite/ramda/assignees{/user}","branches_url":"https://api.github.com/repos/miwillhite/ramda/branches{/branch}","tags_url":"https://api.github.com/repos/miwillhite/ramda/tags","blobs_url":"https://api.github.com/repos/miwillhite/ramda/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miwillhite/ramda/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miwillhite/ramda/git/refs{/sha}","trees_url":"https://api.github.com/repos/miwillhite/ramda/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miwillhite/ramda/statuses/{sha}","languages_url":"https://api.github.com/repos/miwillhite/ramda/languages","stargazers_url":"https://api.github.com/repos/miwillhite/ramda/stargazers","contributors_url":"https://api.github.com/repos/miwillhite/ramda/contributors","subscribers_url":"https://api.github.com/repos/miwillhite/ramda/subscribers","subscription_url":"https://api.github.com/repos/miwillhite/ramda/subscription","commits_url":"https://api.github.com/repos/miwillhite/ramda/commits{/sha}","git_commits_url":"https://api.github.com/repos/miwillhite/ramda/git/commits{/sha}","comments_url":"https://api.github.com/repos/miwillhite/ramda/comments{/number}","issue_comment_url":"https://api.github.com/repos/miwillhite/ramda/issues/comments{/number}","contents_url":"https://api.github.com/repos/miwillhite/ramda/contents/{+path}","compare_url":"https://api.github.com/repos/miwillhite/ramda/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miwillhite/ramda/merges","archive_url":"https://api.github.com/repos/miwillhite/ramda/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miwillhite/ramda/downloads","issues_url":"https://api.github.com/repos/miwillhite/ramda/issues{/number}","pulls_url":"https://api.github.com/repos/miwillhite/ramda/pulls{/number}","milestones_url":"https://api.github.com/repos/miwillhite/ramda/milestones{/number}","notifications_url":"https://api.github.com/repos/miwillhite/ramda/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miwillhite/ramda/labels{/name}","releases_url":"https://api.github.com/repos/miwillhite/ramda/releases{/id}","created_at":"2015-11-19T03:18:02Z","updated_at":"2015-11-19T03:18:04Z","pushed_at":"2015-12-08T18:37:10Z","git_url":"git://github.com/miwillhite/ramda.git","ssh_url":"git@github.com:miwillhite/ramda.git","clone_url":"https://github.com/miwillhite/ramda.git","svn_url":"https://github.com/miwillhite/ramda","homepage":"http://ramdajs.com","size":5125,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"ramda:master","ref":"master","sha":"d13c68f6dd709b6cb3d7af4b61a380385ef8795c","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-12-08T17:41:54Z","pushed_at":"2015-12-08T18:37:10Z","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":6338,"stargazers_count":3289,"watchers_count":3289,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":244,"mirror_url":null,"open_issues_count":90,"forks":244,"open_issues":90,"watchers":3289,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1525"},"html":{"href":"https://github.com/ramda/ramda/pull/1525"},"issue":{"href":"https://api.github.com/repos/ramda/ramda/issues/1525"},"comments":{"href":"https://api.github.com/repos/ramda/ramda/issues/1525/comments"},"review_comments":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1525/comments"},"review_comment":{"href":"https://api.github.com/repos/ramda/ramda/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ramda/ramda/pulls/1525/commits"},"statuses":{"href":"https://api.github.com/repos/ramda/ramda/statuses/fe505ceeff335b7fa354fc8569fc060985540f54"}}}}