{"action":"created","comment":{"url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/comments/46243698","id":46243698,"diff_hunk":"@@ -1,5 +1,178 @@\n 'use strict';\n \n+module.exports.wrap = function (value) {\n+    if (value === undefined) {\n+        return {\n+            value: undefined\n+        };\n+    };\n+    if (value === null) {\n+        return {\n+            value: null\n+        };\n+    };\n+\n+    switch (typeof value) {\n+        case 'number':\n+            return new Number(value);\n+        case 'string':\n+            return new String(value);\n+        case 'boolean':\n+            return new Boolean(value);\n+    }\n+    return value;\n+};\n+\n exports.init = function () {\n+    /*Некоторые методы повторяются из Object в других обьектах,\n+    хотя они и так будут присвоены. Как лучше сделать, оставить их\n+    только в Object или как есть?*/\n+    var objectFns = {\n+        hasKeys: function (fields) {\n+            return checkHasKeys.bind(this)(fields);\n+        },\n+        checkContainsKeys: function (keys) {\n+            return checkHasKeys.bind(this)(keys);\n+        },\n+        hasValueType: function (field, type) {\n+            return checkHasValueType.bind(this)(field, type);\n+        },\n+        containsValues: function (values) {\n+            return checkContainsValues.bind(this)(values);\n+        },\n+        hasValues: function (values) {\n+            return checkHasValues.bind(this)(values);\n+        },\n+        isNull: function () {\n+            return isNull.bind(this)();\n+        }\n+    };\n+    var functionFns = {\n+        hasParamsCount: function (count) {\n+            return checkHasParamsCount.bind(this)(count);\n+        }\n+    };\n+    var arrayFns = {\n+        hasKeys: function (fields) {\n+            return checkHasKeys.bind(this)(fields);\n+        },\n+        hasValueType: function (field, type) {\n+            return checkHasValueType.bind(this)(field, type);\n+        },\n+        checkContainsKeys: function (keys) {\n+            return checkHasKeys.bind(this)(keys);\n+        },\n+        containsValues: function (values) {\n+            return checkContainsValues.bind(this)(values);\n+        },\n+        hasLength: function (count) {\n+            return checkHasLength.bind(this)(count);\n+        },\n+        hasValues: function (values) {\n+            return checkHasValues.bind(this)(values);\n+        }\n+    };\n+    var stringFns = {\n+        hasLength: function (count) {\n+            return checkHasLength.bind(this)(count);\n+        },\n+        hasWordsCount: function (count) {\n+            return checkHasWordsCount.bind(this)(count);\n+        }\n+    };\n+\n+    connectToPrototype(Object.prototype, 'check', objectFns);\n+    connectToPrototype(Function.prototype, 'check', functionFns);\n+    connectToPrototype(Array.prototype, 'check', arrayFns);\n+    connectToPrototype(String.prototype, 'check', stringFns);\n+\n+    function connectToPrototype(objectPrototype, element, methods) {\n+        Object.defineProperty(objectPrototype, element, {\n+            get: function () {\n+                return connect(this, methods);\n+            },\n+            enumerable: false\n+        });\n+    };\n+\n+    function connect(element, methods) {\n+        var curentMethods = Object.keys(methods).reduce(function (prev, key) {\n+            prev[key] = methods[key].bind(element);\n+            return prev;\n+        }.bind(element), {});\n+        curentMethods.not = Object.keys(methods).reduce(function (prev, key) {\n+            prev[key] = not(methods[key]).bind(element);\n+            return prev;\n+        }.bind(element), {});\n+        return curentMethods;\n+    }\n+    function not(method) {\n+        return function () {\n+            return !method.apply(this, arguments);\n+        };\n+    };\n+    function checkContainsKeys(keys) {\n+        return keys.every(item => {\n+            this.hasOwnProperty(item);\n+        });\n+    };\n+    function checkHasKeys(fields) {\n+        return !fields.some(item => {\n+            return !this.hasOwnProperty(item);\n+        });\n+    };\n+    function checkHasValueType(field, type) {\n+        if (!this.hasOwnProperty(field) || typeof this === 'function') {\n+            return false;\n+        }\n+        return typeof this[field] === typeof type();\n+    };\n+    function checkHasLength(count) {\n+        return this.length === count;\n+    };\n+    function checkContainsValues(values) {\n+        return values.every(item => {\n+            return this.hasOwnProperty(item);\n+        });\n+    };\n+    function checkHasValues(values) {","path":"src/check.js","position":138,"original_position":138,"commit_id":"fd91eecf5f50ee3135b0f0a3ed6671221e8bb7ed","original_commit_id":"fd91eecf5f50ee3135b0f0a3ed6671221e8bb7ed","user":{"login":"bratva","id":1937870,"avatar_url":"https://avatars.githubusercontent.com/u/1937870?v=3","gravatar_id":"","url":"https://api.github.com/users/bratva","html_url":"https://github.com/bratva","followers_url":"https://api.github.com/users/bratva/followers","following_url":"https://api.github.com/users/bratva/following{/other_user}","gists_url":"https://api.github.com/users/bratva/gists{/gist_id}","starred_url":"https://api.github.com/users/bratva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bratva/subscriptions","organizations_url":"https://api.github.com/users/bratva/orgs","repos_url":"https://api.github.com/users/bratva/repos","events_url":"https://api.github.com/users/bratva/events{/privacy}","received_events_url":"https://api.github.com/users/bratva/received_events","type":"User","site_admin":false},"body":"```js\r\ncheck.init();\r\nvar person = { name: 'John', age: 20 };\r\nperson.checkHasValues(['John', 20]) // false, а надо true\r\n```","created_at":"2015-12-01T06:19:55Z","updated_at":"2015-12-01T06:19:55Z","html_url":"https://github.com/urfu-2015/javascript-tasks-7/pull/5#discussion_r46243698","pull_request_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/comments/46243698"},"html":{"href":"https://github.com/urfu-2015/javascript-tasks-7/pull/5#discussion_r46243698"},"pull_request":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/5","id":50429281,"html_url":"https://github.com/urfu-2015/javascript-tasks-7/pull/5","diff_url":"https://github.com/urfu-2015/javascript-tasks-7/pull/5.diff","patch_url":"https://github.com/urfu-2015/javascript-tasks-7/pull/5.patch","issue_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/issues/5","number":5,"state":"open","locked":false,"title":"Сорокин Владимир","user":{"login":"sorovlad","id":14935625,"avatar_url":"https://avatars.githubusercontent.com/u/14935625?v=3","gravatar_id":"","url":"https://api.github.com/users/sorovlad","html_url":"https://github.com/sorovlad","followers_url":"https://api.github.com/users/sorovlad/followers","following_url":"https://api.github.com/users/sorovlad/following{/other_user}","gists_url":"https://api.github.com/users/sorovlad/gists{/gist_id}","starred_url":"https://api.github.com/users/sorovlad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorovlad/subscriptions","organizations_url":"https://api.github.com/users/sorovlad/orgs","repos_url":"https://api.github.com/users/sorovlad/repos","events_url":"https://api.github.com/users/sorovlad/events{/privacy}","received_events_url":"https://api.github.com/users/sorovlad/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-11T20:04:11Z","updated_at":"2015-12-01T06:19:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9b9c58cfb6ac69dd4cff969680dfd4c0960229c","assignee":{"login":"bratva","id":1937870,"avatar_url":"https://avatars.githubusercontent.com/u/1937870?v=3","gravatar_id":"","url":"https://api.github.com/users/bratva","html_url":"https://github.com/bratva","followers_url":"https://api.github.com/users/bratva/followers","following_url":"https://api.github.com/users/bratva/following{/other_user}","gists_url":"https://api.github.com/users/bratva/gists{/gist_id}","starred_url":"https://api.github.com/users/bratva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bratva/subscriptions","organizations_url":"https://api.github.com/users/bratva/orgs","repos_url":"https://api.github.com/users/bratva/repos","events_url":"https://api.github.com/users/bratva/events{/privacy}","received_events_url":"https://api.github.com/users/bratva/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/5/commits","review_comments_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/5/comments","review_comment_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/comments{/number}","comments_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/issues/5/comments","statuses_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/statuses/fd91eecf5f50ee3135b0f0a3ed6671221e8bb7ed","head":{"label":"sorovlad:master","ref":"master","sha":"fd91eecf5f50ee3135b0f0a3ed6671221e8bb7ed","user":{"login":"sorovlad","id":14935625,"avatar_url":"https://avatars.githubusercontent.com/u/14935625?v=3","gravatar_id":"","url":"https://api.github.com/users/sorovlad","html_url":"https://github.com/sorovlad","followers_url":"https://api.github.com/users/sorovlad/followers","following_url":"https://api.github.com/users/sorovlad/following{/other_user}","gists_url":"https://api.github.com/users/sorovlad/gists{/gist_id}","starred_url":"https://api.github.com/users/sorovlad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorovlad/subscriptions","organizations_url":"https://api.github.com/users/sorovlad/orgs","repos_url":"https://api.github.com/users/sorovlad/repos","events_url":"https://api.github.com/users/sorovlad/events{/privacy}","received_events_url":"https://api.github.com/users/sorovlad/received_events","type":"User","site_admin":false},"repo":{"id":45991916,"name":"javascript-tasks-7","full_name":"sorovlad/javascript-tasks-7","owner":{"login":"sorovlad","id":14935625,"avatar_url":"https://avatars.githubusercontent.com/u/14935625?v=3","gravatar_id":"","url":"https://api.github.com/users/sorovlad","html_url":"https://github.com/sorovlad","followers_url":"https://api.github.com/users/sorovlad/followers","following_url":"https://api.github.com/users/sorovlad/following{/other_user}","gists_url":"https://api.github.com/users/sorovlad/gists{/gist_id}","starred_url":"https://api.github.com/users/sorovlad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sorovlad/subscriptions","organizations_url":"https://api.github.com/users/sorovlad/orgs","repos_url":"https://api.github.com/users/sorovlad/repos","events_url":"https://api.github.com/users/sorovlad/events{/privacy}","received_events_url":"https://api.github.com/users/sorovlad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sorovlad/javascript-tasks-7","description":"Задача к лекции «Прототипы»","fork":true,"url":"https://api.github.com/repos/sorovlad/javascript-tasks-7","forks_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/forks","keys_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/teams","hooks_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/hooks","issue_events_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/issues/events{/number}","events_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/events","assignees_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/assignees{/user}","branches_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/branches{/branch}","tags_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/tags","blobs_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/git/refs{/sha}","trees_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/statuses/{sha}","languages_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/languages","stargazers_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/stargazers","contributors_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/contributors","subscribers_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/subscribers","subscription_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/subscription","commits_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/commits{/sha}","git_commits_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/git/commits{/sha}","comments_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/comments{/number}","issue_comment_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/issues/comments{/number}","contents_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/contents/{+path}","compare_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/merges","archive_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/downloads","issues_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/issues{/number}","pulls_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/pulls{/number}","milestones_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/milestones{/number}","notifications_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/labels{/name}","releases_url":"https://api.github.com/repos/sorovlad/javascript-tasks-7/releases{/id}","created_at":"2015-11-11T16:00:49Z","updated_at":"2015-11-11T16:00:50Z","pushed_at":"2015-11-23T08:13:57Z","git_url":"git://github.com/sorovlad/javascript-tasks-7.git","ssh_url":"git@github.com:sorovlad/javascript-tasks-7.git","clone_url":"https://github.com/sorovlad/javascript-tasks-7.git","svn_url":"https://github.com/sorovlad/javascript-tasks-7","homepage":"","size":9,"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":"urfu-2015:master","ref":"master","sha":"821475277c12733072cebcc71155a160fd5d37d0","user":{"login":"urfu-2015","id":14800971,"avatar_url":"https://avatars.githubusercontent.com/u/14800971?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2015","html_url":"https://github.com/urfu-2015","followers_url":"https://api.github.com/users/urfu-2015/followers","following_url":"https://api.github.com/users/urfu-2015/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2015/subscriptions","organizations_url":"https://api.github.com/users/urfu-2015/orgs","repos_url":"https://api.github.com/users/urfu-2015/repos","events_url":"https://api.github.com/users/urfu-2015/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2015/received_events","type":"Organization","site_admin":false},"repo":{"id":45921264,"name":"javascript-tasks-7","full_name":"urfu-2015/javascript-tasks-7","owner":{"login":"urfu-2015","id":14800971,"avatar_url":"https://avatars.githubusercontent.com/u/14800971?v=3","gravatar_id":"","url":"https://api.github.com/users/urfu-2015","html_url":"https://github.com/urfu-2015","followers_url":"https://api.github.com/users/urfu-2015/followers","following_url":"https://api.github.com/users/urfu-2015/following{/other_user}","gists_url":"https://api.github.com/users/urfu-2015/gists{/gist_id}","starred_url":"https://api.github.com/users/urfu-2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/urfu-2015/subscriptions","organizations_url":"https://api.github.com/users/urfu-2015/orgs","repos_url":"https://api.github.com/users/urfu-2015/repos","events_url":"https://api.github.com/users/urfu-2015/events{/privacy}","received_events_url":"https://api.github.com/users/urfu-2015/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/urfu-2015/javascript-tasks-7","description":"Задача к лекции «Прототипы»","fork":false,"url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7","forks_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/forks","keys_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/keys{/key_id}","collaborators_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/teams","hooks_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/hooks","issue_events_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/issues/events{/number}","events_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/events","assignees_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/assignees{/user}","branches_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/branches{/branch}","tags_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/tags","blobs_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/git/refs{/sha}","trees_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/git/trees{/sha}","statuses_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/statuses/{sha}","languages_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/languages","stargazers_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/stargazers","contributors_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/contributors","subscribers_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/subscribers","subscription_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/subscription","commits_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/commits{/sha}","git_commits_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/git/commits{/sha}","comments_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/comments{/number}","issue_comment_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/issues/comments{/number}","contents_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/contents/{+path}","compare_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/compare/{base}...{head}","merges_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/merges","archive_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/downloads","issues_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/issues{/number}","pulls_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls{/number}","milestones_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/milestones{/number}","notifications_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/labels{/name}","releases_url":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/releases{/id}","created_at":"2015-11-10T15:32:46Z","updated_at":"2015-11-10T15:50:17Z","pushed_at":"2015-11-30T16:34:19Z","git_url":"git://github.com/urfu-2015/javascript-tasks-7.git","ssh_url":"git@github.com:urfu-2015/javascript-tasks-7.git","clone_url":"https://github.com/urfu-2015/javascript-tasks-7.git","svn_url":"https://github.com/urfu-2015/javascript-tasks-7","homepage":"","size":0,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":46,"mirror_url":null,"open_issues_count":12,"forks":46,"open_issues":12,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/5"},"html":{"href":"https://github.com/urfu-2015/javascript-tasks-7/pull/5"},"issue":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/issues/5"},"comments":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/urfu-2015/javascript-tasks-7/statuses/fd91eecf5f50ee3135b0f0a3ed6671221e8bb7ed"}}}}