GitHub PullRequestReviewCommentEvent at 2014-11-03 21:16:42
Repository: angular-storage
Actor: mgonto
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/auth0/angular-storage/pulls/comments/19764680","id":19764680,"diff_hunk":"@@ -23,12 +23,19 @@ angular.module('angular-storage.internalStore', ['angular-storage.storage'])\n     };\n \n     InternalStore.prototype.get = function(name) {\n-      if (name in this.inMemoryCache) {\n-        return this.inMemoryCache[name];\n+      var self = this;\n+      var obj;\n+      if (name in self.inMemoryCache) {\n+        return self.inMemoryCache[name];\n       }\n-      var saved = storage.get(this.getNamespacedKey(name));\n-      var obj =  saved ? JSON.parse(saved) : null;\n-      this.inMemoryCache[name] = obj;\n+      var saved = storage.get(self.getNamespacedKey(name));\n+      try {","path":"src/angularStorage/services/internalStore.js","position":15,"original_position":15,"commit_id":"60c01645030746aa098cedc257d4fbf4e0a21e8d","original_commit_id":"60c01645030746aa098cedc257d4fbf4e0a21e8d","user":{"login":"mgonto","id":723723,"avatar_url":"https://avatars.githubusercontent.com/u/723723?v=2","gravatar_id":"","url":"https://api.github.com/users/mgonto","html_url":"https://github.com/mgonto","followers_url":"https://api.github.com/users/mgonto/followers","following_url":"https://api.github.com/users/mgonto/following{/other_user}","gists_url":"https://api.github.com/users/mgonto/gists{/gist_id}","starred_url":"https://api.github.com/users/mgonto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgonto/subscriptions","organizations_url":"https://api.github.com/users/mgonto/orgs","repos_url":"https://api.github.com/users/mgonto/repos","events_url":"https://api.github.com/users/mgonto/events{/privacy}","received_events_url":"https://api.github.com/users/mgonto/received_events","type":"User","site_admin":false},"body":"Cange this part to\r\n\r\n````js\r\n try {\r\n        obj = saved ? JSON.parse(saved) : null;\r\n      self.inMemoryCache[name] = obj;\r\n       return obj;\r\n      } catch(e) {\r\n        self.remove(name);\r\n        return null;\r\n      }\r\n\r\n````\r\n\r\nI think it looks better :)","created_at":"2014-11-03T21:16:42Z","updated_at":"2014-11-03T21:16:42Z","html_url":"https://github.com/auth0/angular-storage/pull/14#discussion_r19764680","pull_request_url":"https://api.github.com/repos/auth0/angular-storage/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/auth0/angular-storage/pulls/comments/19764680"},"html":{"href":"https://github.com/auth0/angular-storage/pull/14#discussion_r19764680"},"pull_request":{"href":"https://api.github.com/repos/auth0/angular-storage/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/auth0/angular-storage/pulls/14","id":23791389,"html_url":"https://github.com/auth0/angular-storage/pull/14","diff_url":"https://github.com/auth0/angular-storage/pull/14.diff","patch_url":"https://github.com/auth0/angular-storage/pull/14.patch","issue_url":"https://api.github.com/repos/auth0/angular-storage/issues/14","number":14,"state":"open","locked":false,"title":"fix(InternalStore): invalid value on parse","user":{"login":"gdi2290","id":1016365,"avatar_url":"https://avatars.githubusercontent.com/u/1016365?v=2","gravatar_id":"","url":"https://api.github.com/users/gdi2290","html_url":"https://github.com/gdi2290","followers_url":"https://api.github.com/users/gdi2290/followers","following_url":"https://api.github.com/users/gdi2290/following{/other_user}","gists_url":"https://api.github.com/users/gdi2290/gists{/gist_id}","starred_url":"https://api.github.com/users/gdi2290/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdi2290/subscriptions","organizations_url":"https://api.github.com/users/gdi2290/orgs","repos_url":"https://api.github.com/users/gdi2290/repos","events_url":"https://api.github.com/users/gdi2290/events{/privacy}","received_events_url":"https://api.github.com/users/gdi2290/received_events","type":"User","site_admin":false},"body":"if you get an invalid value JSON.parse throws an error\r\n\r\nlocalcache = {\r\n  'yolo': undefined // should be \"{swag: true, isAuthenticated: true}\"\r\n};\r\n\r\nstore.get('yolo') // JSON.parse error is thrown\r\n\r\n\r\nlocalcache","created_at":"2014-11-03T21:10:28Z","updated_at":"2014-11-03T21:16:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7f37c39e5d2764d17e061fb82d6566e83ffcdb9d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/auth0/angular-storage/pulls/14/commits","review_comments_url":"https://api.github.com/repos/auth0/angular-storage/pulls/14/comments","review_comment_url":"https://api.github.com/repos/auth0/angular-storage/pulls/comments/{number}","comments_url":"https://api.github.com/repos/auth0/angular-storage/issues/14/comments","statuses_url":"https://api.github.com/repos/auth0/angular-storage/statuses/60c01645030746aa098cedc257d4fbf4e0a21e8d","head":{"label":"gdi2290:patch-1","ref":"patch-1","sha":"60c01645030746aa098cedc257d4fbf4e0a21e8d","user":{"login":"gdi2290","id":1016365,"avatar_url":"https://avatars.githubusercontent.com/u/1016365?v=2","gravatar_id":"","url":"https://api.github.com/users/gdi2290","html_url":"https://github.com/gdi2290","followers_url":"https://api.github.com/users/gdi2290/followers","following_url":"https://api.github.com/users/gdi2290/following{/other_user}","gists_url":"https://api.github.com/users/gdi2290/gists{/gist_id}","starred_url":"https://api.github.com/users/gdi2290/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdi2290/subscriptions","organizations_url":"https://api.github.com/users/gdi2290/orgs","repos_url":"https://api.github.com/users/gdi2290/repos","events_url":"https://api.github.com/users/gdi2290/events{/privacy}","received_events_url":"https://api.github.com/users/gdi2290/received_events","type":"User","site_admin":false},"repo":{"id":25483245,"name":"angular-storage","full_name":"gdi2290/angular-storage","owner":{"login":"gdi2290","id":1016365,"avatar_url":"https://avatars.githubusercontent.com/u/1016365?v=2","gravatar_id":"","url":"https://api.github.com/users/gdi2290","html_url":"https://github.com/gdi2290","followers_url":"https://api.github.com/users/gdi2290/followers","following_url":"https://api.github.com/users/gdi2290/following{/other_user}","gists_url":"https://api.github.com/users/gdi2290/gists{/gist_id}","starred_url":"https://api.github.com/users/gdi2290/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdi2290/subscriptions","organizations_url":"https://api.github.com/users/gdi2290/orgs","repos_url":"https://api.github.com/users/gdi2290/repos","events_url":"https://api.github.com/users/gdi2290/events{/privacy}","received_events_url":"https://api.github.com/users/gdi2290/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gdi2290/angular-storage","description":"A storage done right for AngularJS","fork":true,"url":"https://api.github.com/repos/gdi2290/angular-storage","forks_url":"https://api.github.com/repos/gdi2290/angular-storage/forks","keys_url":"https://api.github.com/repos/gdi2290/angular-storage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gdi2290/angular-storage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gdi2290/angular-storage/teams","hooks_url":"https://api.github.com/repos/gdi2290/angular-storage/hooks","issue_events_url":"https://api.github.com/repos/gdi2290/angular-storage/issues/events{/number}","events_url":"https://api.github.com/repos/gdi2290/angular-storage/events","assignees_url":"https://api.github.com/repos/gdi2290/angular-storage/assignees{/user}","branches_url":"https://api.github.com/repos/gdi2290/angular-storage/branches{/branch}","tags_url":"https://api.github.com/repos/gdi2290/angular-storage/tags","blobs_url":"https://api.github.com/repos/gdi2290/angular-storage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gdi2290/angular-storage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gdi2290/angular-storage/git/refs{/sha}","trees_url":"https://api.github.com/repos/gdi2290/angular-storage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gdi2290/angular-storage/statuses/{sha}","languages_url":"https://api.github.com/repos/gdi2290/angular-storage/languages","stargazers_url":"https://api.github.com/repos/gdi2290/angular-storage/stargazers","contributors_url":"https://api.github.com/repos/gdi2290/angular-storage/contributors","subscribers_url":"https://api.github.com/repos/gdi2290/angular-storage/subscribers","subscription_url":"https://api.github.com/repos/gdi2290/angular-storage/subscription","commits_url":"https://api.github.com/repos/gdi2290/angular-storage/commits{/sha}","git_commits_url":"https://api.github.com/repos/gdi2290/angular-storage/git/commits{/sha}","comments_url":"https://api.github.com/repos/gdi2290/angular-storage/comments{/number}","issue_comment_url":"https://api.github.com/repos/gdi2290/angular-storage/issues/comments/{number}","contents_url":"https://api.github.com/repos/gdi2290/angular-storage/contents/{+path}","compare_url":"https://api.github.com/repos/gdi2290/angular-storage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gdi2290/angular-storage/merges","archive_url":"https://api.github.com/repos/gdi2290/angular-storage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gdi2290/angular-storage/downloads","issues_url":"https://api.github.com/repos/gdi2290/angular-storage/issues{/number}","pulls_url":"https://api.github.com/repos/gdi2290/angular-storage/pulls{/number}","milestones_url":"https://api.github.com/repos/gdi2290/angular-storage/milestones{/number}","notifications_url":"https://api.github.com/repos/gdi2290/angular-storage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gdi2290/angular-storage/labels{/name}","releases_url":"https://api.github.com/repos/gdi2290/angular-storage/releases{/id}","created_at":"2014-10-20T19:36:24Z","updated_at":"2014-10-20T15:49:13Z","pushed_at":"2014-11-03T21:10:25Z","git_url":"git://github.com/gdi2290/angular-storage.git","ssh_url":"git@github.com:gdi2290/angular-storage.git","clone_url":"https://github.com/gdi2290/angular-storage.git","svn_url":"https://github.com/gdi2290/angular-storage","homepage":null,"size":144,"stargazers_count":0,"watchers_count":0,"language":null,"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":"auth0:master","ref":"master","sha":"e4c12633b65ddbf84184479674f8a0371c3192c6","user":{"login":"auth0","id":2824157,"avatar_url":"https://avatars.githubusercontent.com/u/2824157?v=2","gravatar_id":"","url":"https://api.github.com/users/auth0","html_url":"https://github.com/auth0","followers_url":"https://api.github.com/users/auth0/followers","following_url":"https://api.github.com/users/auth0/following{/other_user}","gists_url":"https://api.github.com/users/auth0/gists{/gist_id}","starred_url":"https://api.github.com/users/auth0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auth0/subscriptions","organizations_url":"https://api.github.com/users/auth0/orgs","repos_url":"https://api.github.com/users/auth0/repos","events_url":"https://api.github.com/users/auth0/events{/privacy}","received_events_url":"https://api.github.com/users/auth0/received_events","type":"Organization","site_admin":false},"repo":{"id":24724938,"name":"angular-storage","full_name":"auth0/angular-storage","owner":{"login":"auth0","id":2824157,"avatar_url":"https://avatars.githubusercontent.com/u/2824157?v=2","gravatar_id":"","url":"https://api.github.com/users/auth0","html_url":"https://github.com/auth0","followers_url":"https://api.github.com/users/auth0/followers","following_url":"https://api.github.com/users/auth0/following{/other_user}","gists_url":"https://api.github.com/users/auth0/gists{/gist_id}","starred_url":"https://api.github.com/users/auth0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/auth0/subscriptions","organizations_url":"https://api.github.com/users/auth0/orgs","repos_url":"https://api.github.com/users/auth0/repos","events_url":"https://api.github.com/users/auth0/events{/privacy}","received_events_url":"https://api.github.com/users/auth0/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/auth0/angular-storage","description":"A storage done right for AngularJS","fork":false,"url":"https://api.github.com/repos/auth0/angular-storage","forks_url":"https://api.github.com/repos/auth0/angular-storage/forks","keys_url":"https://api.github.com/repos/auth0/angular-storage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/auth0/angular-storage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/auth0/angular-storage/teams","hooks_url":"https://api.github.com/repos/auth0/angular-storage/hooks","issue_events_url":"https://api.github.com/repos/auth0/angular-storage/issues/events{/number}","events_url":"https://api.github.com/repos/auth0/angular-storage/events","assignees_url":"https://api.github.com/repos/auth0/angular-storage/assignees{/user}","branches_url":"https://api.github.com/repos/auth0/angular-storage/branches{/branch}","tags_url":"https://api.github.com/repos/auth0/angular-storage/tags","blobs_url":"https://api.github.com/repos/auth0/angular-storage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/auth0/angular-storage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/auth0/angular-storage/git/refs{/sha}","trees_url":"https://api.github.com/repos/auth0/angular-storage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/auth0/angular-storage/statuses/{sha}","languages_url":"https://api.github.com/repos/auth0/angular-storage/languages","stargazers_url":"https://api.github.com/repos/auth0/angular-storage/stargazers","contributors_url":"https://api.github.com/repos/auth0/angular-storage/contributors","subscribers_url":"https://api.github.com/repos/auth0/angular-storage/subscribers","subscription_url":"https://api.github.com/repos/auth0/angular-storage/subscription","commits_url":"https://api.github.com/repos/auth0/angular-storage/commits{/sha}","git_commits_url":"https://api.github.com/repos/auth0/angular-storage/git/commits{/sha}","comments_url":"https://api.github.com/repos/auth0/angular-storage/comments{/number}","issue_comment_url":"https://api.github.com/repos/auth0/angular-storage/issues/comments/{number}","contents_url":"https://api.github.com/repos/auth0/angular-storage/contents/{+path}","compare_url":"https://api.github.com/repos/auth0/angular-storage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/auth0/angular-storage/merges","archive_url":"https://api.github.com/repos/auth0/angular-storage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/auth0/angular-storage/downloads","issues_url":"https://api.github.com/repos/auth0/angular-storage/issues{/number}","pulls_url":"https://api.github.com/repos/auth0/angular-storage/pulls{/number}","milestones_url":"https://api.github.com/repos/auth0/angular-storage/milestones{/number}","notifications_url":"https://api.github.com/repos/auth0/angular-storage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/auth0/angular-storage/labels{/name}","releases_url":"https://api.github.com/repos/auth0/angular-storage/releases{/id}","created_at":"2014-10-02T15:35:51Z","updated_at":"2014-11-02T23:46:50Z","pushed_at":"2014-10-20T22:18:50Z","git_url":"git://github.com/auth0/angular-storage.git","ssh_url":"git@github.com:auth0/angular-storage.git","clone_url":"https://github.com/auth0/angular-storage.git","svn_url":"https://github.com/auth0/angular-storage","homepage":null,"size":291,"stargazers_count":325,"watchers_count":325,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":5,"forks":14,"open_issues":5,"watchers":325,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/auth0/angular-storage/pulls/14"},"html":{"href":"https://github.com/auth0/angular-storage/pull/14"},"issue":{"href":"https://api.github.com/repos/auth0/angular-storage/issues/14"},"comments":{"href":"https://api.github.com/repos/auth0/angular-storage/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/auth0/angular-storage/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/auth0/angular-storage/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/auth0/angular-storage/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/auth0/angular-storage/statuses/60c01645030746aa098cedc257d4fbf4e0a21e8d"}}}}