From 83f687bc7fb6f1701cf1b64fd81f3c76bc1b69ca Mon Sep 17 00:00:00 2001 From: EricGomez101 Date: Thu, 22 Mar 2018 15:58:35 -0700 Subject: [PATCH 1/4] Completed all the assignments :P --- package-lock.json | 351 ++++++++++++++++++++++++++++++++-------------- package.json | 4 +- src/class.js | 39 ++++++ src/prototype.js | 66 ++++++++- src/recursion.js | 16 ++- src/this.js | 19 ++- 6 files changed, 376 insertions(+), 119 deletions(-) diff --git a/package-lock.json b/package-lock.json index c2d7130..bd621c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "js-homework-1", + "name": "javascript-ii", "version": "1.0.0", "lockfileVersion": 1, "requires": true, @@ -11,9 +11,9 @@ "dev": true }, "acorn": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", - "integrity": "sha512-o96FZLJBPY1lvTuJylGA9Bk3t/GKPPJG8H0ydQQl01crzwJgspa4AEIq/pVTXigmK0PHVQhiAtn8WMBLL9D2WA==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", + "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", "dev": true }, "acorn-globals": { @@ -127,6 +127,14 @@ "sprintf-js": "1.0.3" } }, + "aria-query": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-0.3.0.tgz", + "integrity": "sha1-y4qZhOKGJxHIPICt5bj1yg3itGc=", + "requires": { + "ast-types-flow": "0.0.7" + } + }, "arr-diff": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", @@ -169,6 +177,15 @@ "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", "dev": true }, + "array.prototype.find": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/array.prototype.find/-/array.prototype.find-2.0.4.tgz", + "integrity": "sha1-VWpcU2LAhkgyPdrrnenRS8GGTJA=", + "requires": { + "define-properties": "1.1.2", + "es-abstract": "1.11.0" + } + }, "arrify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", @@ -187,6 +204,11 @@ "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", "dev": true }, + "ast-types-flow": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", + "integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=" + }, "async": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", @@ -829,6 +851,12 @@ "node-int64": "0.4.0" } }, + "buffer-from": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz", + "integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==", + "dev": true + }, "builtin-modules": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", @@ -977,13 +1005,14 @@ "dev": true }, "concat-stream": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", - "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "dev": true, "requires": { + "buffer-from": "1.0.0", "inherits": "2.0.3", - "readable-stream": "2.3.3", + "readable-stream": "2.3.5", "typedarray": "0.0.6" } }, @@ -1046,9 +1075,14 @@ "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", "dev": true, "requires": { - "es5-ext": "0.10.30" + "es5-ext": "0.10.41" } }, + "damerau-levenshtein": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz", + "integrity": "sha1-AxkcQyy27qFou3fzpV/9zLiXhRQ=" + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -1095,6 +1129,15 @@ "strip-bom": "2.0.0" } }, + "define-properties": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", + "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", + "requires": { + "foreach": "2.0.5", + "object-keys": "1.0.11" + } + }, "del": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", @@ -1103,7 +1146,7 @@ "requires": { "globby": "5.0.0", "is-path-cwd": "1.0.0", - "is-path-in-cwd": "1.0.0", + "is-path-in-cwd": "1.0.1", "object-assign": "4.1.1", "pify": "2.3.0", "pinkie-promise": "2.0.1", @@ -1132,13 +1175,12 @@ "dev": true }, "doctrine": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", - "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", "dev": true, "requires": { - "esutils": "2.0.2", - "isarray": "1.0.0" + "esutils": "2.0.2" } }, "ecc-jsbn": { @@ -1151,6 +1193,11 @@ "jsbn": "0.1.1" } }, + "emoji-regex": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-6.5.1.tgz", + "integrity": "sha512-PAHp6TxrCy7MGMFidro8uikr+zlJJKJ/Q6mm2ExZ7HwkyR9lSVFfE3kt36qcwa24BQL7y0G9axycGjK1A/0uNQ==" + }, "errno": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.4.tgz", @@ -1169,24 +1216,47 @@ "is-arrayish": "0.2.1" } }, + "es-abstract": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.11.0.tgz", + "integrity": "sha512-ZnQrE/lXTTQ39ulXZ+J1DTFazV9qBy61x2bY071B+qGco8Z8q1QddsLdt/EF8Ai9hcWH72dWS0kFqXLxOxqslA==", + "requires": { + "es-to-primitive": "1.1.1", + "function-bind": "1.1.1", + "has": "1.0.1", + "is-callable": "1.1.3", + "is-regex": "1.0.4" + } + }, + "es-to-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", + "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", + "requires": { + "is-callable": "1.1.3", + "is-date-object": "1.0.1", + "is-symbol": "1.0.1" + } + }, "es5-ext": { - "version": "0.10.30", - "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.30.tgz", - "integrity": "sha1-cUGhaDZpfbq/qq7uQUlc4p9SyTk=", + "version": "0.10.41", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.41.tgz", + "integrity": "sha512-MYK02wXfwTMie5TEJWPolgOsXEmz7wKCQaGzgmRjZOoV6VLG8I5dSv2bn6AOClXhK64gnSQTQ9W9MKvx87J4gw==", "dev": true, "requires": { - "es6-iterator": "2.0.1", - "es6-symbol": "3.1.1" + "es6-iterator": "2.0.3", + "es6-symbol": "3.1.1", + "next-tick": "1.0.0" } }, "es6-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", - "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.30", + "es5-ext": "0.10.41", "es6-symbol": "3.1.1" } }, @@ -1197,8 +1267,8 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.30", - "es6-iterator": "2.0.1", + "es5-ext": "0.10.41", + "es6-iterator": "2.0.3", "es6-set": "0.1.5", "es6-symbol": "3.1.1", "event-emitter": "0.3.5" @@ -1211,8 +1281,8 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.30", - "es6-iterator": "2.0.1", + "es5-ext": "0.10.41", + "es6-iterator": "2.0.3", "es6-symbol": "3.1.1", "event-emitter": "0.3.5" } @@ -1224,7 +1294,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.30" + "es5-ext": "0.10.41" } }, "es6-weak-map": { @@ -1234,8 +1304,8 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.30", - "es6-iterator": "2.0.1", + "es5-ext": "0.10.41", + "es6-iterator": "2.0.3", "es6-symbol": "3.1.1" } }, @@ -1289,7 +1359,7 @@ "requires": { "es6-map": "0.1.5", "es6-weak-map": "2.0.2", - "esrecurse": "4.2.0", + "esrecurse": "4.2.1", "estraverse": "4.2.0" } }, @@ -1301,22 +1371,22 @@ "requires": { "babel-code-frame": "6.26.0", "chalk": "1.1.3", - "concat-stream": "1.6.0", + "concat-stream": "1.6.2", "debug": "2.6.8", - "doctrine": "2.0.0", + "doctrine": "2.1.0", "escope": "3.6.0", - "espree": "3.5.0", + "espree": "3.5.4", "esquery": "1.0.0", "estraverse": "4.2.0", "esutils": "2.0.2", "file-entry-cache": "2.0.0", "glob": "7.1.2", "globals": "9.18.0", - "ignore": "3.3.5", + "ignore": "3.3.7", "imurmurhash": "0.1.4", "inquirer": "0.12.0", - "is-my-json-valid": "2.16.1", - "is-resolvable": "1.0.0", + "is-my-json-valid": "2.17.2", + "is-resolvable": "1.1.0", "js-yaml": "3.9.1", "json-stable-stringify": "1.0.1", "levn": "0.3.0", @@ -1458,18 +1528,52 @@ } } }, + "eslint-plugin-jsx-a11y": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-4.0.0.tgz", + "integrity": "sha1-d5uw/nsI2lZKQiYkkR3hAGHgSO4=", + "requires": { + "aria-query": "0.3.0", + "ast-types-flow": "0.0.7", + "damerau-levenshtein": "1.0.4", + "emoji-regex": "6.5.1", + "jsx-ast-utils": "1.4.1", + "object-assign": "4.1.1" + } + }, + "eslint-plugin-react": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.9.0.tgz", + "integrity": "sha1-VMLpkGt2+dEBQgML3DTp1oQKC7I=", + "requires": { + "array.prototype.find": "2.0.4", + "doctrine": "1.5.0", + "jsx-ast-utils": "1.4.1" + }, + "dependencies": { + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "requires": { + "esutils": "2.0.2", + "isarray": "1.0.0" + } + } + } + }, "eslint-restricted-globals": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz", "integrity": "sha1-NfDVy8ZMLj7WLpO0saevBbp+1Nc=" }, "espree": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.0.tgz", - "integrity": "sha1-mDWGJb3QVYYeon4oZ+pyn69GPY0=", + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", + "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", "dev": true, "requires": { - "acorn": "5.1.2", + "acorn": "5.5.3", "acorn-jsx": "3.0.1" } }, @@ -1489,13 +1593,12 @@ } }, "esrecurse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", - "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", "dev": true, "requires": { - "estraverse": "4.2.0", - "object-assign": "4.1.1" + "estraverse": "4.2.0" } }, "estraverse": { @@ -1516,7 +1619,7 @@ "dev": true, "requires": { "d": "1.0.0", - "es5-ext": "0.10.30" + "es5-ext": "0.10.41" } }, "exec-sh": { @@ -1604,7 +1707,7 @@ "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", "dev": true, "requires": { - "flat-cache": "1.2.2", + "flat-cache": "1.3.0", "object-assign": "4.1.1" } }, @@ -1647,9 +1750,9 @@ } }, "flat-cache": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.2.2.tgz", - "integrity": "sha1-+oZxTnLCHbiGAXYezy9VXRq8a5Y=", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", + "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", "dev": true, "requires": { "circular-json": "0.3.3", @@ -1673,6 +1776,11 @@ "for-in": "1.0.2" } }, + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -1699,8 +1807,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, "generate-function": { "version": "2.0.0", @@ -1853,7 +1960,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", - "dev": true, "requires": { "function-bind": "1.1.1" } @@ -1933,9 +2039,9 @@ "dev": true }, "ignore": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.5.tgz", - "integrity": "sha512-JLH93mL8amZQhh/p6mfQgVBH3M6epNq3DfsXsTSuSrInVjwyYlFE1nv2AgfRCC8PoOhM0jwQ5v8s9LgbK7yGDw==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz", + "integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==", "dev": true }, "imurmurhash": { @@ -1982,9 +2088,9 @@ } }, "interpret": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.3.tgz", - "integrity": "sha1-y8NcYu7uc/Gat7EKgBURQBr8D5A=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", "dev": true }, "invariant": { @@ -2022,6 +2128,11 @@ "builtin-modules": "1.1.1" } }, + "is-callable": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz", + "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=" + }, "is-ci": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.0.10.tgz", @@ -2031,6 +2142,11 @@ "ci-info": "1.1.1" } }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" + }, "is-dotfile": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", @@ -2085,14 +2201,21 @@ "is-extglob": "1.0.0" } }, + "is-my-ip-valid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", + "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==", + "dev": true + }, "is-my-json-valid": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.1.tgz", - "integrity": "sha512-ochPsqWS1WXj8ZnMIV0vnNXooaMhp7cyL4FMSIPKTtnV0Ha/T19G2b9kkhcNsabV9bxYkze7/aLZJb/bYuFduQ==", + "version": "2.17.2", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz", + "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", "dev": true, "requires": { "generate-function": "2.0.0", "generate-object-property": "1.2.0", + "is-my-ip-valid": "1.0.0", "jsonpointer": "4.0.1", "xtend": "4.0.1" } @@ -2113,18 +2236,18 @@ "dev": true }, "is-path-in-cwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", - "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", "dev": true, "requires": { - "is-path-inside": "1.0.0" + "is-path-inside": "1.0.1" } }, "is-path-inside": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", - "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", "dev": true, "requires": { "path-is-inside": "1.0.2" @@ -2148,15 +2271,25 @@ "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", "dev": true }, - "is-resolvable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", - "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", - "dev": true, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "requires": { - "tryit": "1.0.3" + "has": "1.0.1" } }, + "is-resolvable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "dev": true + }, + "is-symbol": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", + "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=" + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -2172,8 +2305,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isexe": { "version": "2.0.0", @@ -2688,6 +2820,11 @@ } } }, + "jsx-ast-utils": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz", + "integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=" + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -2869,6 +3006,12 @@ "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", + "dev": true + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -2929,8 +3072,12 @@ "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-keys": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", + "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=" }, "object.omit": { "version": "2.0.1", @@ -2953,7 +3100,7 @@ }, "onetime": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "dev": true }, @@ -3188,9 +3335,9 @@ "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" }, "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", "dev": true }, "progress": { @@ -3301,15 +3448,15 @@ } }, "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.5.tgz", + "integrity": "sha512-tK0yDhrkygt/knjowCUiWP9YdV7c5R+8cR0r/kt9ZhBU906Fs6RpQJCEilamRJj1Nx2rWI6LkW9gKqjTkshhEw==", "dev": true, "requires": { "core-util-is": "1.0.2", "inherits": "2.0.3", "isarray": "1.0.0", - "process-nextick-args": "1.0.7", + "process-nextick-args": "2.0.0", "safe-buffer": "5.1.1", "string_decoder": "1.0.3", "util-deprecate": "1.0.2" @@ -3598,7 +3745,7 @@ "dev": true, "requires": { "glob": "7.1.2", - "interpret": "1.0.3", + "interpret": "1.1.0", "rechoir": "0.6.2" } }, @@ -3695,15 +3842,6 @@ } } }, - "string_decoder": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", - "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", - "dev": true, - "requires": { - "safe-buffer": "5.1.1" - } - }, "string-length": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/string-length/-/string-length-1.0.1.tgz", @@ -3724,6 +3862,15 @@ "strip-ansi": "3.0.1" } }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -3874,12 +4021,6 @@ "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", "dev": true }, - "tryit": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", - "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", - "dev": true - }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", diff --git a/package.json b/package.json index f761ac7..58535af 100644 --- a/package.json +++ b/package.json @@ -12,10 +12,10 @@ "repository": { "type": "git", "url": "git+https://github.com/LambdaSchool/javascript-ii.git" - }, + }, "devDependencies": { "babel-jest": "^19.0.0", - "eslint": "^3.17.1", + "eslint": "^3.19.0", "eslint-config-airbnb-base": "^11.1.3", "eslint-plugin-import": "^2.2.0", "jest": "^19.0.2", diff --git a/src/class.js b/src/class.js index 1ec26ec..bc886fb 100644 --- a/src/class.js +++ b/src/class.js @@ -8,7 +8,22 @@ // Return true if the potential password matches the `password` property. Otherwise return false. // code here +class User { + constructor(options) { + this.email = options.email; + this.password = options.password; + } + comparePasswords(password) { + return this.password === password; + } +} +const playerOne = new User({ + email: 'eric@example.com', + password: 'oonga', +}); + +// console.log(playerOne.comparePasswords("oonga")) // Part 2 // Create a class called `Animal` and a class called `Cat` using ES6 classes. // `Cat` should extend the `Animal` class. @@ -20,7 +35,31 @@ // property set on the Cat instance. // code here +class Animal { + constructor(options) { + this.age = options.age, + } + growOlder() { + return this.age += 7; + } +} + +class Cat extends Animal { + constructor(options) { + super(options), + this.name = options.name, + } + meow() { + return `${this.name} meowed!`; + } +} + +const mrWhiskers = new Cat({ + name: 'mr whisker', + age: 2, +}); +// console.log(mrWhiskers.meow()); /* eslint-disable no-undef */ module.exports = { diff --git a/src/prototype.js b/src/prototype.js index e2494a6..a6904aa 100644 --- a/src/prototype.js +++ b/src/prototype.js @@ -48,11 +48,67 @@ hamsterHuey.takeDamage(); // returns 'Hamster Huey took damage.' hamsterHuey.destroy(); // returns 'Game object was removed from the game.' */ +function GameObject(props) { + this.date = props.date; + this.dimensions = props.dimensions; +} + +GameObject.prototype.destroy = function() { + return 'Game object was removed from the game.'; +} + +function NPC(props) { + GameObject.call(this, props); + this.hp = props.hp; + this.name = props.name; + +} + +NPC.prototype = Object.create(GameObject.prototype); + +NPC.prototype.takeDamage = function(amnt) { + this.hp = amnt !== undefined ? this.hp - amnt : this.hp - 1; + if(this.hp <= 0) { + return this.destroy(); + } + return `${this.name} took damage. ${this.hp} health points left.`; +} + +function Humanoid(props) { + NPC.call(this, props); + this.faction = props.faction; + this.weapons = props.weapons; + this.language = props.language; +} +Humanoid.prototype = Object.create(NPC.prototype); + +Humanoid.prototype.greet = function() { + return `${this.name} offers a greeting in .`; +} + +const playerOne = new Humanoid({ + date: new Date(), + dimensions: { + length: 2, + width: 2, + height: 2, + }, + hp: 100, + name: "bob", + faction: 'el oh el', + weapons: [ + 'WMD', + 'pistol', + ], + language: 'weeb', +}); + +console.log(playerOne.takeDamage(65)); /* eslint-disable no-undef */ -module.exports = { - GameObject, - NPC, - Humanoid, -}; +// module.exports = { +// GameObject, +// NPC, +// Humanoid, +// }; diff --git a/src/recursion.js b/src/recursion.js index a6a6c13..985f0c0 100644 --- a/src/recursion.js +++ b/src/recursion.js @@ -1,15 +1,25 @@ // Complete the following functions. - const nFibonacci = (n) => { - // fibonacci sequence: 1 1 2 3 5 8 13 ... - // return the nth number in the sequence + if (n < 2) { + return n; + } + return nFibonacci(n - 1) + nFibonacci(n - 2); }; const nFactorial = (n) => { // factorial example: !5 = 5 * 4 * 3 * 2 * 1 // return the factorial of `n` + let sum = 1; + const loop = () => { + if (n < 2) return sum; + sum *= n; + return loop(--n); + }; + return loop(); }; +// console.log(nFactorial(5)); + /* Extra Credit */ const checkMatchingLeaves = (obj) => { // return true if every property on `obj` is the same diff --git a/src/this.js b/src/this.js index f0f994c..69dae78 100644 --- a/src/this.js +++ b/src/this.js @@ -7,10 +7,15 @@ class User { constructor(options) { // set a username and password property on the user object that is created + this.username = options.username; + this.password = options.password; } // create a method on the User class called `checkPassword` // this method should take in a string and compare it to the object's password property // return `true` if they match, otherwise return `false` + checkPassword(password) { + return password === this.password; + } } const me = new User({ @@ -19,7 +24,7 @@ const me = new User({ }); const result = me.checkPassword('correcthorsebatterystaple'); // should return `true` - +// console.log(result); /* part 2 */ const checkPassword = function comparePasswords(passwordToCompare) { @@ -27,13 +32,19 @@ const checkPassword = function comparePasswords(passwordToCompare) { // use `this` to access the object's `password` property. // do not modify this function's parameters // note that we use the `function` keyword and not `=>` + return this.password === passwordToCompare; }; // invoke `checkPassword` on `me` by explicitly setting the `this` context // use .call, .apply, and .bind - +// // .call - +console.log(checkPassword.call(me, "correcthorsebatterystaple")); +// // .apply - +console.log(checkPassword.apply(me, ["correcthorsebatterystaple"])); +// // .bind +// +const x = checkPassword.bind(me); +console.log(x("correcthorsebatterystaple")); From 2968564bea90ac0e95d7327265708f96330726b5 Mon Sep 17 00:00:00 2001 From: EricGomez101 Date: Thu, 22 Mar 2018 16:04:46 -0700 Subject: [PATCH 2/4] Completed all the assignments :P --- src/class.js | 2 +- src/prototype.js | 19 +++++++++---------- src/this.js | 6 +++--- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/class.js b/src/class.js index bc886fb..e51ee4a 100644 --- a/src/class.js +++ b/src/class.js @@ -39,7 +39,7 @@ class Animal { constructor(options) { this.age = options.age, } - growOlder() { + growOlder(){ return this.age += 7; } } diff --git a/src/prototype.js b/src/prototype.js index a6904aa..e1ddab1 100644 --- a/src/prototype.js +++ b/src/prototype.js @@ -53,26 +53,25 @@ function GameObject(props) { this.dimensions = props.dimensions; } -GameObject.prototype.destroy = function() { +GameObject.prototype.destroy = function () { return 'Game object was removed from the game.'; -} +}; function NPC(props) { GameObject.call(this, props); this.hp = props.hp; this.name = props.name; - } NPC.prototype = Object.create(GameObject.prototype); -NPC.prototype.takeDamage = function(amnt) { +NPC.prototype.takeDamage = function (amnt) { this.hp = amnt !== undefined ? this.hp - amnt : this.hp - 1; - if(this.hp <= 0) { + if (this.hp <= 0) { return this.destroy(); } return `${this.name} took damage. ${this.hp} health points left.`; -} +}; function Humanoid(props) { NPC.call(this, props); @@ -82,9 +81,9 @@ function Humanoid(props) { } Humanoid.prototype = Object.create(NPC.prototype); -Humanoid.prototype.greet = function() { +Humanoid.prototype.greet = function () { return `${this.name} offers a greeting in .`; -} +}; const playerOne = new Humanoid({ date: new Date(), @@ -94,7 +93,7 @@ const playerOne = new Humanoid({ height: 2, }, hp: 100, - name: "bob", + name: 'bob', faction: 'el oh el', weapons: [ 'WMD', @@ -103,7 +102,7 @@ const playerOne = new Humanoid({ language: 'weeb', }); -console.log(playerOne.takeDamage(65)); +// console.log(playerOne.takeDamage(65)); /* eslint-disable no-undef */ diff --git a/src/this.js b/src/this.js index 69dae78..38884e8 100644 --- a/src/this.js +++ b/src/this.js @@ -39,12 +39,12 @@ const checkPassword = function comparePasswords(passwordToCompare) { // use .call, .apply, and .bind // // .call -console.log(checkPassword.call(me, "correcthorsebatterystaple")); +console.log(checkPassword.call(me, 'correcthorsebatterystaple')); // // .apply -console.log(checkPassword.apply(me, ["correcthorsebatterystaple"])); +console.log(checkPassword.apply(me, ['correcthorsebatterystaple'])); // // .bind // const x = checkPassword.bind(me); -console.log(x("correcthorsebatterystaple")); +console.log(x('correcthorsebatterystaple')); From ea6a1d3eeafa83e9745b1f47088c33a51a0ece46 Mon Sep 17 00:00:00 2001 From: EricGomez101 Date: Fri, 23 Mar 2018 19:33:55 -0700 Subject: [PATCH 3/4] fixed lint errors and parse exceptions --- src/class.js | 8 ++++---- src/prototype.js | 4 ++-- src/this.js | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/class.js b/src/class.js index e51ee4a..5160521 100644 --- a/src/class.js +++ b/src/class.js @@ -37,17 +37,17 @@ const playerOne = new User({ // code here class Animal { constructor(options) { - this.age = options.age, + this.age = options.age; } - growOlder(){ + growOlder() { return this.age += 7; } } class Cat extends Animal { constructor(options) { - super(options), - this.name = options.name, + super(options); + this.name = options.name; } meow() { return `${this.name} meowed!`; diff --git a/src/prototype.js b/src/prototype.js index e1ddab1..544f0cd 100644 --- a/src/prototype.js +++ b/src/prototype.js @@ -82,7 +82,7 @@ function Humanoid(props) { Humanoid.prototype = Object.create(NPC.prototype); Humanoid.prototype.greet = function () { - return `${this.name} offers a greeting in .`; + return `${this.name} offers a greeting in ${this.language}`; }; const playerOne = new Humanoid({ @@ -102,7 +102,7 @@ const playerOne = new Humanoid({ language: 'weeb', }); -// console.log(playerOne.takeDamage(65)); +console.log(playerOne.greet()); /* eslint-disable no-undef */ diff --git a/src/this.js b/src/this.js index 38884e8..1918b7b 100644 --- a/src/this.js +++ b/src/this.js @@ -39,12 +39,12 @@ const checkPassword = function comparePasswords(passwordToCompare) { // use .call, .apply, and .bind // // .call -console.log(checkPassword.call(me, 'correcthorsebatterystaple')); +// console.log(checkPassword.call(me, 'correcthorsebatterystaple')); // // .apply -console.log(checkPassword.apply(me, ['correcthorsebatterystaple'])); +// console.log(checkPassword.apply(me, ['correcthorsebatterystaple'])); // // .bind // -const x = checkPassword.bind(me); -console.log(x('correcthorsebatterystaple')); +// const x = checkPassword.bind(me); +// console.log(x('correcthorsebatterystaple')); From fe61323b8169f359f291d03da680fb808f5dba28 Mon Sep 17 00:00:00 2001 From: EricGomez101 Date: Fri, 23 Mar 2018 19:47:28 -0700 Subject: [PATCH 4/4] uncommented the module exporter --- src/class.js | 2 +- src/prototype.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/class.js b/src/class.js index 5160521..46cc6c2 100644 --- a/src/class.js +++ b/src/class.js @@ -59,7 +59,7 @@ const mrWhiskers = new Cat({ age: 2, }); -// console.log(mrWhiskers.meow()); +// console.log(mrWhiskers.age); /* eslint-disable no-undef */ module.exports = { diff --git a/src/prototype.js b/src/prototype.js index 544f0cd..f6d47a9 100644 --- a/src/prototype.js +++ b/src/prototype.js @@ -102,12 +102,12 @@ const playerOne = new Humanoid({ language: 'weeb', }); -console.log(playerOne.greet()); +// console.log(playerOne.greet()); /* eslint-disable no-undef */ -// module.exports = { -// GameObject, -// NPC, -// Humanoid, -// }; +module.exports = { + GameObject, + NPC, + Humanoid, +};