GitHub PullRequestReviewCommentEvent at 2014-12-29 19:37:55
Repository: objectstate
Actor: jarofghosts
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/urbanairship/objectstate/pulls/comments/22325107","id":22325107,"diff_hunk":"@@ -174,134 +256,105 @@ test('deepcopy creates deep copy of state', function(assert) {\n   expect.inner = inner\n   expect.inner.a = Math.random()\n   expect.inner.b = [Math.random()]\n-  os = new ObjectState(expect)\n-  result = os.deepcopy()\n+  os = objectState(expect)\n+  result = os.state()\n   assert.notStrictEqual(result.inner, expect.inner)\n   assert.notStrictEqual(result, expect)\n   assert.deepEqual(result, expect)\n-  assert.end()\n })\n \n-test('copy creates shallow copy of state', function(assert) {\n-  var expect = {}\n-    , inner = {}\n+test('emits a deep-copy of state', function(assert) {\n+  assert.plan(2)\n+\n+  var written = {cats: true}\n     , result\n     , os\n \n-  expect.inner = inner\n-  expect.inner.a = Math.random()\n-  expect.inner.b = [Math.random()]\n-  os = new ObjectState(expect)\n-  result = os.copy()\n-  assert.notStrictEqual(result, expect)\n-  assert.equal(result.inner, expect.inner)\n-  assert.deepEqual(result, expect)\n-  assert.end()\n+  os = objectState()\n+\n+  os.once('data', function(state) {\n+    result = state\n+  })\n+\n+  os.write(written)\n+\n+  assert.deepEqual(written, result)\n+  assert.notEqual(written, result)\n })\n \n-test('snapshot resets state', function(assert) {\n-  var os = new ObjectState()\n-    , ee = new EE()\n+test('can nest `.wait()` statements', function(assert) {\n+  assert.plan(1)\n+\n+  var os = objectState()\n+    , stream = through()\n     , count = 0\n-    , expect_0\n-    , expect_1\n-    , restore\n+\n+  os.listen(stream, 'herp')\n \n   os.on('data', function() {\n     ++count\n   })\n \n-  expect_0 = Math.random()\n-  expect_1 = expect_0 + 1\n-  os.listen(ee, 'data', ['value'])\n-  ee.emit('data', expect_0)\n-  assert.equal(os.state.value, expect_0)\n-  restore = os.snapshot()\n-  ee.emit('data', expect_1)\n-  assert.equal(os.state.value, expect_1)\n-  restore()\n-  assert.equal(os.state.value, expect_0)\n-  assert.equal(count, 3)\n-  assert.end()\n-})\n-\n-test('include returns other instance of OS', function(assert) {\n-  var os_one = new ObjectState()\n-    , os_two = new ObjectState()\n-\n-  assert.equal(os_one.include(os_two), os_two)\n-  assert.end()\n-})\n+  os.wait(function() {\n+    os.wait(function() {\n+      stream.queue('flerp')\n+      stream.queue('werp')\n+    })\n \n-test('include puts os_b\\'s properties on os_a; chains', function(assert) {\n-  var os_a = new ObjectState()\n-    , os_b = new ObjectState()\n-    , os_c = new ObjectState()\n-    , ee = new EE()\n+    stream.queue('herp')\n+    stream.queue('merp')\n+  })\n \n-  os_a.include(os_b).include(os_c)\n-  os_c.listen(ee, 'foo', ['c'])\n-  os_b.listen(ee, 'foo', ['b'])\n-  os_a.listen(ee, 'boo', ['a'])\n-  ee.emit('boo', 2)\n-  assert.equal(os_a.state.a, 2)\n-  assert.equal(os_a.state.b, undefined)\n-  assert.equal(os_a.state.c, undefined)\n-  assert.equal(os_b.state.a, undefined)\n-  assert.equal(os_b.state.b, undefined)\n-  assert.equal(os_b.state.c, undefined)\n-  assert.equal(os_c.state.a, undefined)\n-  assert.equal(os_c.state.b, undefined)\n-  assert.equal(os_c.state.c, undefined)\n-  ee.emit('foo', 3)\n-  assert.equal(os_a.state.a, 2)\n-  assert.equal(os_a.state.b, 3)\n-  assert.equal(os_a.state.c, 3)\n-  assert.equal(os_b.state.a, undefined)\n-  assert.equal(os_b.state.b, 3)\n-  assert.equal(os_b.state.c, 3)\n-  assert.equal(os_c.state.a, undefined)\n-  assert.equal(os_c.state.b, undefined)\n-  assert.equal(os_c.state.c, 3)\n-  assert.end()\n+  assert.equal(count, 1)","path":"test.js","position":451,"original_position":451,"commit_id":"05944295af76c297b3577af8518bc5fb9c22f0e1","original_commit_id":"05944295af76c297b3577af8518bc5fb9c22f0e1","user":{"login":"jarofghosts","id":1013892,"avatar_url":"https://avatars.githubusercontent.com/u/1013892?v=3","gravatar_id":"","url":"https://api.github.com/users/jarofghosts","html_url":"https://github.com/jarofghosts","followers_url":"https://api.github.com/users/jarofghosts/followers","following_url":"https://api.github.com/users/jarofghosts/following{/other_user}","gists_url":"https://api.github.com/users/jarofghosts/gists{/gist_id}","starred_url":"https://api.github.com/users/jarofghosts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarofghosts/subscriptions","organizations_url":"https://api.github.com/users/jarofghosts/orgs","repos_url":"https://api.github.com/users/jarofghosts/repos","events_url":"https://api.github.com/users/jarofghosts/events{/privacy}","received_events_url":"https://api.github.com/users/jarofghosts/received_events","type":"User","site_admin":false},"body":"its not what the test is for, and that is tested elsewhere, but im not strictly opposed to it","created_at":"2014-12-29T19:37:55Z","updated_at":"2014-12-29T19:37:55Z","html_url":"https://github.com/urbanairship/objectstate/pull/14#discussion_r22325107","pull_request_url":"https://api.github.com/repos/urbanairship/objectstate/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/urbanairship/objectstate/pulls/comments/22325107"},"html":{"href":"https://github.com/urbanairship/objectstate/pull/14#discussion_r22325107"},"pull_request":{"href":"https://api.github.com/repos/urbanairship/objectstate/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/urbanairship/objectstate/pulls/14","id":26489302,"html_url":"https://github.com/urbanairship/objectstate/pull/14","diff_url":"https://github.com/urbanairship/objectstate/pull/14.diff","patch_url":"https://github.com/urbanairship/objectstate/pull/14.patch","issue_url":"https://api.github.com/repos/urbanairship/objectstate/issues/14","number":14,"state":"open","locked":false,"title":"Emit on change, deep copy objects","user":{"login":"jarofghosts","id":1013892,"avatar_url":"https://avatars.githubusercontent.com/u/1013892?v=3","gravatar_id":"","url":"https://api.github.com/users/jarofghosts","html_url":"https://github.com/jarofghosts","followers_url":"https://api.github.com/users/jarofghosts/followers","following_url":"https://api.github.com/users/jarofghosts/following{/other_user}","gists_url":"https://api.github.com/users/jarofghosts/gists{/gist_id}","starred_url":"https://api.github.com/users/jarofghosts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarofghosts/subscriptions","organizations_url":"https://api.github.com/users/jarofghosts/orgs","repos_url":"https://api.github.com/users/jarofghosts/repos","events_url":"https://api.github.com/users/jarofghosts/events{/privacy}","received_events_url":"https://api.github.com/users/jarofghosts/received_events","type":"User","site_admin":false},"body":"To version: `2.0.0`\r\n\r\n* Only emit on change\r\n* Deep copy all objects on input and output\r\n* Add keypath access\r\n* Fix nested `.wait()`\r\n\r\nThis also, somewhat controversially, switches ObjectState to use a more \"functional\" style internally. This successfully hides the internal state object from any outside mutation, and does not present any notable performance hits.","created_at":"2014-12-23T00:09:38Z","updated_at":"2014-12-29T19:37:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"31e9de45c3a16d0746bb0f61b28278085341d76a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/urbanairship/objectstate/pulls/14/commits","review_comments_url":"https://api.github.com/repos/urbanairship/objectstate/pulls/14/comments","review_comment_url":"https://api.github.com/repos/urbanairship/objectstate/pulls/comments/{number}","comments_url":"https://api.github.com/repos/urbanairship/objectstate/issues/14/comments","statuses_url":"https://api.github.com/repos/urbanairship/objectstate/statuses/05944295af76c297b3577af8518bc5fb9c22f0e1","head":{"label":"urbanairship:version-2","ref":"version-2","sha":"05944295af76c297b3577af8518bc5fb9c22f0e1","user":{"login":"urbanairship","id":360059,"avatar_url":"https://avatars.githubusercontent.com/u/360059?v=3","gravatar_id":"","url":"https://api.github.com/users/urbanairship","html_url":"https://github.com/urbanairship","followers_url":"https://api.github.com/users/urbanairship/followers","following_url":"https://api.github.com/users/urbanairship/following{/other_user}","gists_url":"https://api.github.com/users/urbanairship/gists{/gist_id}","starred_url":"https://api.github.com/users/urbanairship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbanairship/subscriptions","organizations_url":"https://api.github.com/users/urbanairship/orgs","repos_url":"https://api.github.com/users/urbanairship/repos","events_url":"https://api.github.com/users/urbanairship/events{/privacy}","received_events_url":"https://api.github.com/users/urbanairship/received_events","type":"Organization","site_admin":false},"repo":{"id":28195890,"name":"objectstate","full_name":"urbanairship/objectstate","owner":{"login":"urbanairship","id":360059,"avatar_url":"https://avatars.githubusercontent.com/u/360059?v=3","gravatar_id":"","url":"https://api.github.com/users/urbanairship","html_url":"https://github.com/urbanairship","followers_url":"https://api.github.com/users/urbanairship/followers","following_url":"https://api.github.com/users/urbanairship/following{/other_user}","gists_url":"https://api.github.com/users/urbanairship/gists{/gist_id}","starred_url":"https://api.github.com/users/urbanairship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbanairship/subscriptions","organizations_url":"https://api.github.com/users/urbanairship/orgs","repos_url":"https://api.github.com/users/urbanairship/repos","events_url":"https://api.github.com/users/urbanairship/events{/privacy}","received_events_url":"https://api.github.com/users/urbanairship/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urbanairship/objectstate","description":"Streaming state management for node and the browser","fork":false,"url":"https://api.github.com/repos/urbanairship/objectstate","forks_url":"https://api.github.com/repos/urbanairship/objectstate/forks","keys_url":"https://api.github.com/repos/urbanairship/objectstate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urbanairship/objectstate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urbanairship/objectstate/teams","hooks_url":"https://api.github.com/repos/urbanairship/objectstate/hooks","issue_events_url":"https://api.github.com/repos/urbanairship/objectstate/issues/events{/number}","events_url":"https://api.github.com/repos/urbanairship/objectstate/events","assignees_url":"https://api.github.com/repos/urbanairship/objectstate/assignees{/user}","branches_url":"https://api.github.com/repos/urbanairship/objectstate/branches{/branch}","tags_url":"https://api.github.com/repos/urbanairship/objectstate/tags","blobs_url":"https://api.github.com/repos/urbanairship/objectstate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urbanairship/objectstate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urbanairship/objectstate/git/refs{/sha}","trees_url":"https://api.github.com/repos/urbanairship/objectstate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urbanairship/objectstate/statuses/{sha}","languages_url":"https://api.github.com/repos/urbanairship/objectstate/languages","stargazers_url":"https://api.github.com/repos/urbanairship/objectstate/stargazers","contributors_url":"https://api.github.com/repos/urbanairship/objectstate/contributors","subscribers_url":"https://api.github.com/repos/urbanairship/objectstate/subscribers","subscription_url":"https://api.github.com/repos/urbanairship/objectstate/subscription","commits_url":"https://api.github.com/repos/urbanairship/objectstate/commits{/sha}","git_commits_url":"https://api.github.com/repos/urbanairship/objectstate/git/commits{/sha}","comments_url":"https://api.github.com/repos/urbanairship/objectstate/comments{/number}","issue_comment_url":"https://api.github.com/repos/urbanairship/objectstate/issues/comments/{number}","contents_url":"https://api.github.com/repos/urbanairship/objectstate/contents/{+path}","compare_url":"https://api.github.com/repos/urbanairship/objectstate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urbanairship/objectstate/merges","archive_url":"https://api.github.com/repos/urbanairship/objectstate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urbanairship/objectstate/downloads","issues_url":"https://api.github.com/repos/urbanairship/objectstate/issues{/number}","pulls_url":"https://api.github.com/repos/urbanairship/objectstate/pulls{/number}","milestones_url":"https://api.github.com/repos/urbanairship/objectstate/milestones{/number}","notifications_url":"https://api.github.com/repos/urbanairship/objectstate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urbanairship/objectstate/labels{/name}","releases_url":"https://api.github.com/repos/urbanairship/objectstate/releases{/id}","created_at":"2014-12-18T18:24:42Z","updated_at":"2014-12-29T00:39:06Z","pushed_at":"2014-12-23T01:22:39Z","git_url":"git://github.com/urbanairship/objectstate.git","ssh_url":"git@github.com:urbanairship/objectstate.git","clone_url":"https://github.com/urbanairship/objectstate.git","svn_url":"https://github.com/urbanairship/objectstate","homepage":null,"size":356,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":4,"default_branch":"master"}},"base":{"label":"urbanairship:master","ref":"master","sha":"6bc45e1479f2a4a91b308e91c763fe7b68c9061c","user":{"login":"urbanairship","id":360059,"avatar_url":"https://avatars.githubusercontent.com/u/360059?v=3","gravatar_id":"","url":"https://api.github.com/users/urbanairship","html_url":"https://github.com/urbanairship","followers_url":"https://api.github.com/users/urbanairship/followers","following_url":"https://api.github.com/users/urbanairship/following{/other_user}","gists_url":"https://api.github.com/users/urbanairship/gists{/gist_id}","starred_url":"https://api.github.com/users/urbanairship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbanairship/subscriptions","organizations_url":"https://api.github.com/users/urbanairship/orgs","repos_url":"https://api.github.com/users/urbanairship/repos","events_url":"https://api.github.com/users/urbanairship/events{/privacy}","received_events_url":"https://api.github.com/users/urbanairship/received_events","type":"Organization","site_admin":false},"repo":{"id":28195890,"name":"objectstate","full_name":"urbanairship/objectstate","owner":{"login":"urbanairship","id":360059,"avatar_url":"https://avatars.githubusercontent.com/u/360059?v=3","gravatar_id":"","url":"https://api.github.com/users/urbanairship","html_url":"https://github.com/urbanairship","followers_url":"https://api.github.com/users/urbanairship/followers","following_url":"https://api.github.com/users/urbanairship/following{/other_user}","gists_url":"https://api.github.com/users/urbanairship/gists{/gist_id}","starred_url":"https://api.github.com/users/urbanairship/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urbanairship/subscriptions","organizations_url":"https://api.github.com/users/urbanairship/orgs","repos_url":"https://api.github.com/users/urbanairship/repos","events_url":"https://api.github.com/users/urbanairship/events{/privacy}","received_events_url":"https://api.github.com/users/urbanairship/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urbanairship/objectstate","description":"Streaming state management for node and the browser","fork":false,"url":"https://api.github.com/repos/urbanairship/objectstate","forks_url":"https://api.github.com/repos/urbanairship/objectstate/forks","keys_url":"https://api.github.com/repos/urbanairship/objectstate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urbanairship/objectstate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urbanairship/objectstate/teams","hooks_url":"https://api.github.com/repos/urbanairship/objectstate/hooks","issue_events_url":"https://api.github.com/repos/urbanairship/objectstate/issues/events{/number}","events_url":"https://api.github.com/repos/urbanairship/objectstate/events","assignees_url":"https://api.github.com/repos/urbanairship/objectstate/assignees{/user}","branches_url":"https://api.github.com/repos/urbanairship/objectstate/branches{/branch}","tags_url":"https://api.github.com/repos/urbanairship/objectstate/tags","blobs_url":"https://api.github.com/repos/urbanairship/objectstate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urbanairship/objectstate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urbanairship/objectstate/git/refs{/sha}","trees_url":"https://api.github.com/repos/urbanairship/objectstate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urbanairship/objectstate/statuses/{sha}","languages_url":"https://api.github.com/repos/urbanairship/objectstate/languages","stargazers_url":"https://api.github.com/repos/urbanairship/objectstate/stargazers","contributors_url":"https://api.github.com/repos/urbanairship/objectstate/contributors","subscribers_url":"https://api.github.com/repos/urbanairship/objectstate/subscribers","subscription_url":"https://api.github.com/repos/urbanairship/objectstate/subscription","commits_url":"https://api.github.com/repos/urbanairship/objectstate/commits{/sha}","git_commits_url":"https://api.github.com/repos/urbanairship/objectstate/git/commits{/sha}","comments_url":"https://api.github.com/repos/urbanairship/objectstate/comments{/number}","issue_comment_url":"https://api.github.com/repos/urbanairship/objectstate/issues/comments/{number}","contents_url":"https://api.github.com/repos/urbanairship/objectstate/contents/{+path}","compare_url":"https://api.github.com/repos/urbanairship/objectstate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urbanairship/objectstate/merges","archive_url":"https://api.github.com/repos/urbanairship/objectstate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urbanairship/objectstate/downloads","issues_url":"https://api.github.com/repos/urbanairship/objectstate/issues{/number}","pulls_url":"https://api.github.com/repos/urbanairship/objectstate/pulls{/number}","milestones_url":"https://api.github.com/repos/urbanairship/objectstate/milestones{/number}","notifications_url":"https://api.github.com/repos/urbanairship/objectstate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urbanairship/objectstate/labels{/name}","releases_url":"https://api.github.com/repos/urbanairship/objectstate/releases{/id}","created_at":"2014-12-18T18:24:42Z","updated_at":"2014-12-29T00:39:06Z","pushed_at":"2014-12-23T01:22:39Z","git_url":"git://github.com/urbanairship/objectstate.git","ssh_url":"git@github.com:urbanairship/objectstate.git","clone_url":"https://github.com/urbanairship/objectstate.git","svn_url":"https://github.com/urbanairship/objectstate","homepage":null,"size":356,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":6,"forks":0,"open_issues":6,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urbanairship/objectstate/pulls/14"},"html":{"href":"https://github.com/urbanairship/objectstate/pull/14"},"issue":{"href":"https://api.github.com/repos/urbanairship/objectstate/issues/14"},"comments":{"href":"https://api.github.com/repos/urbanairship/objectstate/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/urbanairship/objectstate/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/urbanairship/objectstate/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/urbanairship/objectstate/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/urbanairship/objectstate/statuses/05944295af76c297b3577af8518bc5fb9c22f0e1"}}}}