{"action":"created","comment":{"url":"https://api.github.com/repos/StreamMeDev/storage/pulls/comments/93806047","pull_request_review_id":14342951,"id":93806047,"diff_hunk":"@@ -0,0 +1,165 @@\n+var storage = require('./drivers/storage');\n+var cookie = require('./drivers/cookie');\n+var memory = require('./drivers/memory');\n+\n+/**\n+* A storage service\n+*\n+* Basic Usage:\n+*\n+*   storage.setItem('someKey', 'someValue');\n+*   storage.getItem('someKey'); // 'someValue'\n+*   storage.removeItem('someKey');\n+*   storage.clear();\n+*\n+* The storage module allows storing data in localStorage, sessionStorage, cookies\n+* or in memory, all with the same interface.  You can create a new\n+* instance to manually select a storage backend:\n+*\n+*   var store = new torage.Storage({\n+*     backend: 'cookie'\n+*   });\n+*   store.setItem('key', 'val', {\n+*     expires: 60 // one minute\n+*   });\n+*\n+* All backends support expiration and path.  The cookie\n+* backend also supports domain and a secure flag.  You can also\n+* set filters for the key's and values.  These can be used\n+* to modify things like json encoding objects for storage,\n+* or adding a prefix to the storage key.\n+*\n+* NOTE: The storage backends need to be registerd in the order\n+* in which they should be tried.  So typically that would be this:\n+*\n+* - localStorage\n+* - cookie\n+* - memory\n+*\n+* @constructor Storage\n+* @param {object} [opts] - The storage options\n+*/\n+var Storage = module.exports = function (opts = {}) {\n+\t// Ensure it is created with new\n+\tif (!(this instanceof Storage)) {\n+\t\treturn new Storage(opts);\n+\t}\n+\n+\t// Merge options\n+\tthis.options = Object.assign({}, Storage.defaultOptions, opts);\n+\n+\t// Get the backend\n+\tvar Backend;\n+\tif (typeof this.options.backend === 'string') {\n+\t\tBackend = getBackend(this.options.backend);\n+\t} else if (this.options.backend) {\n+\t\tBackend = this.options.backend;\n+\t} else {\n+\t\tBackend = selectBackend();\n+\t}\n+\n+\t// Verify that we got a backend\n+\tif (!Backend) {\n+\t\treturn;\n+\t}\n+\n+\t// Create backend instance\n+\tthis.backend = new Backend();\n+};\n+\n+/**\n+ * Default options\n+ *\n+ * @var defaultOptions\n+ * @memberof Storage\n+ * @static\n+ */\n+Storage.defaultOptions = {\n+\tbackend: null,\n+\tdomain: null,\n+\tsetValueFilter: ident,\n+\tgetValueFilter: ident,\n+\tkeyFilter: ident\n+};\n+\n+/**\n+ * Get an item from storage\n+ *\n+ * @function getItem\n+ * @memberof Storage\n+ * @instance\n+ * @param {string} key - The key to get\n+ * @return {*} - The value from storage\n+ */\n+Storage.prototype.getItem = function (key) {\n+\treturn this.options.getValueFilter(this.backend.getItem(this.options.keyFilter(key)));\n+};\n+\n+/**\n+ * Sets an item in storage\n+ *\n+ * @function setItem\n+ * @memberof Storage\n+ * @instance\n+ * @param {string} key - The storage key to set\n+ * @param {*} value - The value to store\n+ * @param {object} [params] - The optional storage params\n+ */\n+Storage.prototype.setItem = function (key, value, params = {}) {\n+\tparams.domain = params.domain || this.options.domain;\n+\treturn this.backend.setItem(this.options.keyFilter(key), this.options.setValueFilter(value), params);\n+};\n+\n+/**\n+ * Remove an item from storage\n+ *\n+ * @function removeItem\n+ * @memberof Storage\n+ * @instance\n+ * @param {string} key - The key to remove\n+ * @param {object} [params] - The params to use for removal\n+ */\n+Storage.prototype.removeItem = function (key, params = {}) {\n+\tparams.domain = params.domain || this.options.domain;\n+\treturn this.backend.removeItem(this.options.keyFilter(key), params);\n+};\n+\n+/**\n+ * Clear out an entire backend store\n+ *\n+ * @function clear\n+ * @memberof Storage\n+ * @instance\n+ */\n+Storage.prototype.clear = function () {\n+\treturn this.backend.clear();\n+};\n+\n+// Gets a particular storage backend by it's name\n+Storage.backends = [storage('localStorage'), cookie, storage('sessionStorage'), memory];\n+function getBackend (name) {\n+\tfor (var i = 0, len = Storage.backends.length; i < len; i++) {","path":"src/index.js","position":141,"original_position":141,"commit_id":"2d2beb18452f2c7ae972f54d5d23d4bdf460affb","original_commit_id":"05c691c55969c0cdd0c046bb82ffcc2a5eba3fc0","user":{"login":"cwebley","id":5498820,"avatar_url":"https://avatars.githubusercontent.com/u/5498820?v=3","gravatar_id":"","url":"https://api.github.com/users/cwebley","html_url":"https://github.com/cwebley","followers_url":"https://api.github.com/users/cwebley/followers","following_url":"https://api.github.com/users/cwebley/following{/other_user}","gists_url":"https://api.github.com/users/cwebley/gists{/gist_id}","starred_url":"https://api.github.com/users/cwebley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cwebley/subscriptions","organizations_url":"https://api.github.com/users/cwebley/orgs","repos_url":"https://api.github.com/users/cwebley/repos","events_url":"https://api.github.com/users/cwebley/events{/privacy}","received_events_url":"https://api.github.com/users/cwebley/received_events","type":"User","site_admin":false},"body":"oh well if you change this, you might as well also change the for loop a couple lines below this. didnt bother to comment because it is breaking early also which is likely technically better than [].filter","created_at":"2016-12-23T22:30:32Z","updated_at":"2016-12-23T22:30:32Z","html_url":"https://github.com/StreamMeDev/storage/pull/1#discussion_r93806047","pull_request_url":"https://api.github.com/repos/StreamMeDev/storage/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/StreamMeDev/storage/pulls/comments/93806047"},"html":{"href":"https://github.com/StreamMeDev/storage/pull/1#discussion_r93806047"},"pull_request":{"href":"https://api.github.com/repos/StreamMeDev/storage/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/StreamMeDev/storage/pulls/1","id":99277450,"html_url":"https://github.com/StreamMeDev/storage/pull/1","diff_url":"https://github.com/StreamMeDev/storage/pull/1.diff","patch_url":"https://github.com/StreamMeDev/storage/pull/1.patch","issue_url":"https://api.github.com/repos/StreamMeDev/storage/issues/1","number":1,"state":"open","locked":false,"title":"Initial work","user":{"login":"wesleytodd","id":1027776,"avatar_url":"https://avatars.githubusercontent.com/u/1027776?v=3","gravatar_id":"","url":"https://api.github.com/users/wesleytodd","html_url":"https://github.com/wesleytodd","followers_url":"https://api.github.com/users/wesleytodd/followers","following_url":"https://api.github.com/users/wesleytodd/following{/other_user}","gists_url":"https://api.github.com/users/wesleytodd/gists{/gist_id}","starred_url":"https://api.github.com/users/wesleytodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wesleytodd/subscriptions","organizations_url":"https://api.github.com/users/wesleytodd/orgs","repos_url":"https://api.github.com/users/wesleytodd/repos","events_url":"https://api.github.com/users/wesleytodd/events{/privacy}","received_events_url":"https://api.github.com/users/wesleytodd/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-23T20:03:47Z","updated_at":"2016-12-23T22:30:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c6a0bd2a2d9704c862b1c126c7da997195fb232f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/StreamMeDev/storage/pulls/1/commits","review_comments_url":"https://api.github.com/repos/StreamMeDev/storage/pulls/1/comments","review_comment_url":"https://api.github.com/repos/StreamMeDev/storage/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StreamMeDev/storage/issues/1/comments","statuses_url":"https://api.github.com/repos/StreamMeDev/storage/statuses/2d2beb18452f2c7ae972f54d5d23d4bdf460affb","head":{"label":"StreamMeDev:initial-work","ref":"initial-work","sha":"2d2beb18452f2c7ae972f54d5d23d4bdf460affb","user":{"login":"StreamMeDev","id":17912029,"avatar_url":"https://avatars.githubusercontent.com/u/17912029?v=3","gravatar_id":"","url":"https://api.github.com/users/StreamMeDev","html_url":"https://github.com/StreamMeDev","followers_url":"https://api.github.com/users/StreamMeDev/followers","following_url":"https://api.github.com/users/StreamMeDev/following{/other_user}","gists_url":"https://api.github.com/users/StreamMeDev/gists{/gist_id}","starred_url":"https://api.github.com/users/StreamMeDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StreamMeDev/subscriptions","organizations_url":"https://api.github.com/users/StreamMeDev/orgs","repos_url":"https://api.github.com/users/StreamMeDev/repos","events_url":"https://api.github.com/users/StreamMeDev/events{/privacy}","received_events_url":"https://api.github.com/users/StreamMeDev/received_events","type":"Organization","site_admin":false},"repo":{"id":77247977,"name":"storage","full_name":"StreamMeDev/storage","owner":{"login":"StreamMeDev","id":17912029,"avatar_url":"https://avatars.githubusercontent.com/u/17912029?v=3","gravatar_id":"","url":"https://api.github.com/users/StreamMeDev","html_url":"https://github.com/StreamMeDev","followers_url":"https://api.github.com/users/StreamMeDev/followers","following_url":"https://api.github.com/users/StreamMeDev/following{/other_user}","gists_url":"https://api.github.com/users/StreamMeDev/gists{/gist_id}","starred_url":"https://api.github.com/users/StreamMeDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StreamMeDev/subscriptions","organizations_url":"https://api.github.com/users/StreamMeDev/orgs","repos_url":"https://api.github.com/users/StreamMeDev/repos","events_url":"https://api.github.com/users/StreamMeDev/events{/privacy}","received_events_url":"https://api.github.com/users/StreamMeDev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StreamMeDev/storage","description":"A web storage wrapper","fork":false,"url":"https://api.github.com/repos/StreamMeDev/storage","forks_url":"https://api.github.com/repos/StreamMeDev/storage/forks","keys_url":"https://api.github.com/repos/StreamMeDev/storage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StreamMeDev/storage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StreamMeDev/storage/teams","hooks_url":"https://api.github.com/repos/StreamMeDev/storage/hooks","issue_events_url":"https://api.github.com/repos/StreamMeDev/storage/issues/events{/number}","events_url":"https://api.github.com/repos/StreamMeDev/storage/events","assignees_url":"https://api.github.com/repos/StreamMeDev/storage/assignees{/user}","branches_url":"https://api.github.com/repos/StreamMeDev/storage/branches{/branch}","tags_url":"https://api.github.com/repos/StreamMeDev/storage/tags","blobs_url":"https://api.github.com/repos/StreamMeDev/storage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StreamMeDev/storage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StreamMeDev/storage/git/refs{/sha}","trees_url":"https://api.github.com/repos/StreamMeDev/storage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StreamMeDev/storage/statuses/{sha}","languages_url":"https://api.github.com/repos/StreamMeDev/storage/languages","stargazers_url":"https://api.github.com/repos/StreamMeDev/storage/stargazers","contributors_url":"https://api.github.com/repos/StreamMeDev/storage/contributors","subscribers_url":"https://api.github.com/repos/StreamMeDev/storage/subscribers","subscription_url":"https://api.github.com/repos/StreamMeDev/storage/subscription","commits_url":"https://api.github.com/repos/StreamMeDev/storage/commits{/sha}","git_commits_url":"https://api.github.com/repos/StreamMeDev/storage/git/commits{/sha}","comments_url":"https://api.github.com/repos/StreamMeDev/storage/comments{/number}","issue_comment_url":"https://api.github.com/repos/StreamMeDev/storage/issues/comments{/number}","contents_url":"https://api.github.com/repos/StreamMeDev/storage/contents/{+path}","compare_url":"https://api.github.com/repos/StreamMeDev/storage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StreamMeDev/storage/merges","archive_url":"https://api.github.com/repos/StreamMeDev/storage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StreamMeDev/storage/downloads","issues_url":"https://api.github.com/repos/StreamMeDev/storage/issues{/number}","pulls_url":"https://api.github.com/repos/StreamMeDev/storage/pulls{/number}","milestones_url":"https://api.github.com/repos/StreamMeDev/storage/milestones{/number}","notifications_url":"https://api.github.com/repos/StreamMeDev/storage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StreamMeDev/storage/labels{/name}","releases_url":"https://api.github.com/repos/StreamMeDev/storage/releases{/id}","deployments_url":"https://api.github.com/repos/StreamMeDev/storage/deployments","created_at":"2016-12-23T20:02:28Z","updated_at":"2016-12-23T20:02:28Z","pushed_at":"2016-12-23T22:25:33Z","git_url":"git://github.com/StreamMeDev/storage.git","ssh_url":"git@github.com:StreamMeDev/storage.git","clone_url":"https://github.com/StreamMeDev/storage.git","svn_url":"https://github.com/StreamMeDev/storage","homepage":null,"size":8,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"StreamMeDev:master","ref":"master","sha":"63c50fd7fdd857cdad5058a36ac191cbe49dadd2","user":{"login":"StreamMeDev","id":17912029,"avatar_url":"https://avatars.githubusercontent.com/u/17912029?v=3","gravatar_id":"","url":"https://api.github.com/users/StreamMeDev","html_url":"https://github.com/StreamMeDev","followers_url":"https://api.github.com/users/StreamMeDev/followers","following_url":"https://api.github.com/users/StreamMeDev/following{/other_user}","gists_url":"https://api.github.com/users/StreamMeDev/gists{/gist_id}","starred_url":"https://api.github.com/users/StreamMeDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StreamMeDev/subscriptions","organizations_url":"https://api.github.com/users/StreamMeDev/orgs","repos_url":"https://api.github.com/users/StreamMeDev/repos","events_url":"https://api.github.com/users/StreamMeDev/events{/privacy}","received_events_url":"https://api.github.com/users/StreamMeDev/received_events","type":"Organization","site_admin":false},"repo":{"id":77247977,"name":"storage","full_name":"StreamMeDev/storage","owner":{"login":"StreamMeDev","id":17912029,"avatar_url":"https://avatars.githubusercontent.com/u/17912029?v=3","gravatar_id":"","url":"https://api.github.com/users/StreamMeDev","html_url":"https://github.com/StreamMeDev","followers_url":"https://api.github.com/users/StreamMeDev/followers","following_url":"https://api.github.com/users/StreamMeDev/following{/other_user}","gists_url":"https://api.github.com/users/StreamMeDev/gists{/gist_id}","starred_url":"https://api.github.com/users/StreamMeDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StreamMeDev/subscriptions","organizations_url":"https://api.github.com/users/StreamMeDev/orgs","repos_url":"https://api.github.com/users/StreamMeDev/repos","events_url":"https://api.github.com/users/StreamMeDev/events{/privacy}","received_events_url":"https://api.github.com/users/StreamMeDev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StreamMeDev/storage","description":"A web storage wrapper","fork":false,"url":"https://api.github.com/repos/StreamMeDev/storage","forks_url":"https://api.github.com/repos/StreamMeDev/storage/forks","keys_url":"https://api.github.com/repos/StreamMeDev/storage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StreamMeDev/storage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StreamMeDev/storage/teams","hooks_url":"https://api.github.com/repos/StreamMeDev/storage/hooks","issue_events_url":"https://api.github.com/repos/StreamMeDev/storage/issues/events{/number}","events_url":"https://api.github.com/repos/StreamMeDev/storage/events","assignees_url":"https://api.github.com/repos/StreamMeDev/storage/assignees{/user}","branches_url":"https://api.github.com/repos/StreamMeDev/storage/branches{/branch}","tags_url":"https://api.github.com/repos/StreamMeDev/storage/tags","blobs_url":"https://api.github.com/repos/StreamMeDev/storage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StreamMeDev/storage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StreamMeDev/storage/git/refs{/sha}","trees_url":"https://api.github.com/repos/StreamMeDev/storage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StreamMeDev/storage/statuses/{sha}","languages_url":"https://api.github.com/repos/StreamMeDev/storage/languages","stargazers_url":"https://api.github.com/repos/StreamMeDev/storage/stargazers","contributors_url":"https://api.github.com/repos/StreamMeDev/storage/contributors","subscribers_url":"https://api.github.com/repos/StreamMeDev/storage/subscribers","subscription_url":"https://api.github.com/repos/StreamMeDev/storage/subscription","commits_url":"https://api.github.com/repos/StreamMeDev/storage/commits{/sha}","git_commits_url":"https://api.github.com/repos/StreamMeDev/storage/git/commits{/sha}","comments_url":"https://api.github.com/repos/StreamMeDev/storage/comments{/number}","issue_comment_url":"https://api.github.com/repos/StreamMeDev/storage/issues/comments{/number}","contents_url":"https://api.github.com/repos/StreamMeDev/storage/contents/{+path}","compare_url":"https://api.github.com/repos/StreamMeDev/storage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StreamMeDev/storage/merges","archive_url":"https://api.github.com/repos/StreamMeDev/storage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StreamMeDev/storage/downloads","issues_url":"https://api.github.com/repos/StreamMeDev/storage/issues{/number}","pulls_url":"https://api.github.com/repos/StreamMeDev/storage/pulls{/number}","milestones_url":"https://api.github.com/repos/StreamMeDev/storage/milestones{/number}","notifications_url":"https://api.github.com/repos/StreamMeDev/storage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StreamMeDev/storage/labels{/name}","releases_url":"https://api.github.com/repos/StreamMeDev/storage/releases{/id}","deployments_url":"https://api.github.com/repos/StreamMeDev/storage/deployments","created_at":"2016-12-23T20:02:28Z","updated_at":"2016-12-23T20:02:28Z","pushed_at":"2016-12-23T22:25:33Z","git_url":"git://github.com/StreamMeDev/storage.git","ssh_url":"git@github.com:StreamMeDev/storage.git","clone_url":"https://github.com/StreamMeDev/storage.git","svn_url":"https://github.com/StreamMeDev/storage","homepage":null,"size":8,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/StreamMeDev/storage/pulls/1"},"html":{"href":"https://github.com/StreamMeDev/storage/pull/1"},"issue":{"href":"https://api.github.com/repos/StreamMeDev/storage/issues/1"},"comments":{"href":"https://api.github.com/repos/StreamMeDev/storage/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/StreamMeDev/storage/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/StreamMeDev/storage/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StreamMeDev/storage/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/StreamMeDev/storage/statuses/2d2beb18452f2c7ae972f54d5d23d4bdf460affb"}}}}
{"actor":{"display_login":"cwebley"}}