diff --git a/package-lock.json b/package-lock.json index c2d7130..6bf30e0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "acorn": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz", - "integrity": "sha512-o96FZLJBPY1lvTuJylGA9Bk3t/GKPPJG8H0ydQQl01crzwJgspa4AEIq/pVTXigmK0PHVQhiAtn8WMBLL9D2WA==", + "integrity": "sha1-kRy1PgNoB88Pp3jcXTcPvYZCRtc=", "dev": true }, "acorn-globals": { @@ -102,7 +102,7 @@ "anymatch": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", - "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "integrity": "sha1-VT3Lj5HjyImEXf26NMd3IbkLnXo=", "dev": true, "requires": { "micromatch": "2.3.11", @@ -139,7 +139,7 @@ "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", "dev": true }, "array-equal": { @@ -190,7 +190,7 @@ "async": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", + "integrity": "sha1-hDGQ/WtzV6C54clW7d3V7IRitU0=", "dev": true, "requires": { "lodash": "4.17.4" @@ -709,7 +709,7 @@ "regenerator-runtime": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", - "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==" + "integrity": "sha1-flT+W1zNXWYk6mJVw0c74JC4AuE=" } } }, @@ -755,7 +755,7 @@ "babylon": { "version": "6.18.0", "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" + "integrity": "sha1-ry87iPpvXB5MY00aD46sT1WzleM=" }, "balanced-match": { "version": "1.0.0", @@ -889,13 +889,13 @@ "ci-info": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.1.tgz", - "integrity": "sha512-vHDDF/bP9RYpTWtUhpJRhCFdvvp3iDWvEbuDbWgvjUrNGV1MXJrE0MPcwGtEled04m61iwdBLUIHZtDgzWS4ZQ==", + "integrity": "sha1-R7RN8RjEjSWXtW00Ln4leRBgFxo=", "dev": true }, "circular-json": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", - "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", + "integrity": "sha1-gVyZ6oT2gJUp0vRXkb34JxE1LWY=", "dev": true }, "cli-cursor": { @@ -1128,7 +1128,7 @@ "diff": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", - "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "integrity": "sha1-qoVnpu7QPFMfyJ0/cRzQ5SWd7HU=", "dev": true }, "doctrine": { @@ -1355,7 +1355,7 @@ "eslint-config-airbnb-base": { "version": "11.3.2", "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.3.2.tgz", - "integrity": "sha512-/fhjt/VqzBA2SRsx7ErDtv6Ayf+XLw9LIOqmpBuHFCVwyJo2EtzGWMB9fYRFBoWWQLxmNmCpenNiH0RxyeS41w==", + "integrity": "sha1-hwOxGr48iKx+wrdFt/31LgCuaAo=", "requires": { "eslint-restricted-globals": "0.1.1" } @@ -1363,7 +1363,7 @@ "eslint-import-resolver-node": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz", - "integrity": "sha512-yUtXS15gIcij68NmXmP9Ni77AQuCN0itXbCc/jWd8C6/yKZaSNXicpC8cgvjnxVdmfsosIXrjpzFq7GcDryb6A==", + "integrity": "sha1-RCJXTN5mqaewmZOO5NUIoZng48w=", "dev": true, "requires": { "debug": "2.6.8", @@ -1373,7 +1373,7 @@ "eslint-module-utils": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz", - "integrity": "sha512-jDI/X5l/6D1rRD/3T43q8Qgbls2nq5km5KSqiwlyUbGo5+04fXhMKdCPhjwbqAa6HXWaMxj8Q4hQDIh7IadJQw==", + "integrity": "sha1-q67IJBd2E7ipWymWOeG2+s9HNEk=", "dev": true, "requires": { "debug": "2.6.8", @@ -1381,9 +1381,9 @@ } }, "eslint-plugin-import": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.7.0.tgz", - "integrity": "sha512-HGYmpU9f/zJaQiKNQOVfHUh2oLWW3STBrCgH0sHTX1xtsxYlH1zjLh8FlQGEIdZSdTbUMaV36WaZ6ImXkenGxQ==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz", + "integrity": "sha512-Rf7dfKJxZ16QuTgVv1OYNxkZcsu/hULFnC+e+w0Gzi6jMC3guQoWQgxYxc54IDRinlb6/0v5z/PxxIKmVctN+g==", "dev": true, "requires": { "builtin-modules": "1.1.1", @@ -1476,7 +1476,7 @@ "esprima": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "integrity": "sha1-RJnt3NERDgshi6zy+n9/WfVcqAQ=", "dev": true }, "esquery": { @@ -1699,7 +1699,7 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=", "dev": true }, "generate-function": { @@ -1743,7 +1743,7 @@ "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -1776,7 +1776,7 @@ "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==" + "integrity": "sha1-qjiWs+abSH8X4x7SFD1pqOMMLYo=" }, "globby": { "version": "5.0.0", @@ -1903,7 +1903,7 @@ "hosted-git-info": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "integrity": "sha1-bWDjSzq7yDEwYsO3mO+NkBoHrzw=", "dev": true }, "html-encoding-sniffer": { @@ -1935,7 +1935,7 @@ "ignore": { "version": "3.3.5", "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.5.tgz", - "integrity": "sha512-JLH93mL8amZQhh/p6mfQgVBH3M6epNq3DfsXsTSuSrInVjwyYlFE1nv2AgfRCC8PoOhM0jwQ5v8s9LgbK7yGDw==", + "integrity": "sha1-xOcVRV9gc6jX5drnLS/J1xZj26Y=", "dev": true }, "imurmurhash": { @@ -2088,7 +2088,7 @@ "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==", + "integrity": "sha1-WoRnd+LCYg0eaRBOXToDsfYIjxE=", "dev": true, "requires": { "generate-function": "2.0.0", @@ -2218,13 +2218,13 @@ "istanbul-lib-coverage": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-1.1.1.tgz", - "integrity": "sha512-0+1vDkmzxqJIn5rcoEqapSB4DmPxE31EtI2dF2aCkV5esN9EWHxZ0dwgDClivMXJqE7zaYQxq30hj5L0nlTN5Q==", + "integrity": "sha1-c7+5mIhSmUFck9OKPprfeEp3qdo=", "dev": true }, "istanbul-lib-hook": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-1.0.7.tgz", - "integrity": "sha512-3U2HB9y1ZV9UmFlE12Fx+nPtFqIymzrqCksrXujm3NVbAZIJg/RfYgO1XiIa0mbmxTjWpVEVlkIZJ25xVIAfkQ==", + "integrity": "sha1-3WYH8DB2V4/n1vKmMM8UO0m6zdw=", "dev": true, "requires": { "append-transform": "0.4.0" @@ -2248,7 +2248,7 @@ "istanbul-lib-report": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-1.1.1.tgz", - "integrity": "sha512-tvF+YmCmH4thnez6JFX06ujIA19WPa9YUiwjc1uALF2cv5dmE3It8b5I8Ob7FHJ70H9Y5yF+TDkVa/mcADuw1Q==", + "integrity": "sha1-8OVfVmVf+jQiIIC3oM1HYOFAX8k=", "dev": true, "requires": { "istanbul-lib-coverage": "1.1.1", @@ -2271,7 +2271,7 @@ "istanbul-lib-source-maps": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-1.2.1.tgz", - "integrity": "sha512-mukVvSXCn9JQvdJl8wP/iPhqig0MRtuWuD4ZNKo6vB2Ik//AmhAKe3QnPN02dmkRe3lTudFk3rzoHhwU4hb94w==", + "integrity": "sha1-pv4ay6jOCO68Y45XLilNJnAIqgw=", "dev": true, "requires": { "debug": "2.6.8", @@ -2831,7 +2831,7 @@ "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "dev": true, "requires": { "brace-expansion": "1.1.8" @@ -2890,7 +2890,7 @@ "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "integrity": "sha1-EvlaMH1YNSB1oEkHuErIvpisAS8=", "dev": true, "requires": { "hosted-git-info": "2.5.0", @@ -3174,7 +3174,7 @@ "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "integrity": "sha1-wVm41b4PnlpvNG2rlPFs4CIWG4g=", "dev": true, "requires": { "color-convert": "1.9.0" @@ -3220,7 +3220,7 @@ "randomatic": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "integrity": "sha1-x6vpzIuHwLqodrGf3oP9RkeX44w=", "dev": true, "requires": { "is-number": "3.0.0", @@ -3303,7 +3303,7 @@ "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==", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { "core-util-is": "1.0.2", @@ -3349,7 +3349,7 @@ "regenerator-transform": { "version": "0.10.1", "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", - "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", + "integrity": "sha1-HkmWg3Ix2ot/PPQRTXG1aRoGgN0=", "requires": { "babel-runtime": "6.26.0", "babel-types": "6.26.0", @@ -3359,7 +3359,7 @@ "regex-cache": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "integrity": "sha1-db3FiioUls7EihKDW8VMjVYjNt0=", "dev": true, "requires": { "is-equal-shallow": "0.1.3" @@ -3470,7 +3470,7 @@ "resolve": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", - "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "integrity": "sha1-p1vgHFPaJdk0qY69DkxKcxL5KoY=", "dev": true, "requires": { "path-parse": "1.0.5" @@ -3529,7 +3529,7 @@ "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", "dev": true }, "sane": { @@ -3576,13 +3576,13 @@ "sax": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", + "integrity": "sha1-KBYjTiN4vdxOU1T6tcqold9xANk=", "dev": true }, "semver": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "integrity": "sha1-4FnAnYVx8FQII3M0M1BdOi8AsY4=", "dev": true }, "set-blocking": { @@ -3605,7 +3605,7 @@ "shellwords": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", - "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", + "integrity": "sha1-1rkYHBpI05cyTISHHvvPxz/AZUs=", "dev": true }, "slash": { @@ -3695,15 +3695,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 +3715,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": "sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=", + "dev": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, "stringstream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", @@ -3793,7 +3793,7 @@ "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "integrity": "sha1-q5Pyeo3BPSjKyBXEYhQ6bZASrp4=", "dev": true, "requires": { "is-fullwidth-code-point": "2.0.0", @@ -3814,7 +3814,7 @@ "test-exclude": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-4.1.1.tgz", - "integrity": "sha512-35+Asrsk3XHJDBgf/VRFexPgh3UyETv8IAn/LRTiZjVy6rjPVqdEk8dJcJYBzl1w0XCJM48lvTy8SfEsCWS4nA==", + "integrity": "sha1-TYSWSwlmsAh+zDNKLOAC09k0HiY=", "dev": true, "requires": { "arrify": "1.0.1", @@ -3833,7 +3833,7 @@ "throat": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/throat/-/throat-3.2.0.tgz", - "integrity": "sha512-/EY8VpvlqJ+sFtLPeOgc8Pl7kQVOWv0woD87KTXVHPIAE842FGT+rokxIhe8xIUP1cfgrkt0as0vDLjDiMtr8w==", + "integrity": "sha1-UMsGcO28QCN7njR9fh+I5GIK+DY=", "dev": true }, "through": { @@ -3963,7 +3963,7 @@ "uuid": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", - "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==", + "integrity": "sha1-PdPT55Crwk17DToDT/q6vijrvAQ=", "dev": true }, "validate-npm-package-license": { @@ -4013,7 +4013,7 @@ "webidl-conversions": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", - "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==", + "integrity": "sha1-qFWYCx8LazWbodXZ+zmulB+qY60=", "dev": true }, "whatwg-encoding": { @@ -4046,7 +4046,7 @@ "which": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", - "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "integrity": "sha1-/wS9/AEO5UfXgL7DjhrBwnd9JTo=", "dev": true, "requires": { "isexe": "2.0.0" @@ -4074,7 +4074,7 @@ "worker-farm": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.5.0.tgz", - "integrity": "sha512-DHRiUggxtbruaTwnLDm2/BRDKZIoOYvrgYUj5Bam4fU6Gtvc0FaEyoswFPBjMXAweGW2H4BDNIpy//1yXXuaqQ==", + "integrity": "sha1-rf3wzUBYFGXtCh9kj5c1cir9XI0=", "dev": true, "requires": { "errno": "0.1.4", diff --git a/package.json b/package.json index d23afbd..1b89fb3 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "babel-jest": "^19.0.0", "eslint": "^3.17.1", "eslint-config-airbnb-base": "^11.1.3", - "eslint-plugin-import": "^2.2.0", + "eslint-plugin-import": "^2.8.0", "jest": "^19.0.2", "regenerator-runtime": "^0.10.3" }, diff --git a/src/arrays.js b/src/arrays.js index b995952..2fb4255 100644 --- a/src/arrays.js +++ b/src/arrays.js @@ -2,41 +2,86 @@ // These functions only need to work with arrays. // Do NOT use the built in array methods to solve these. forEach, map, reduce, filter, includes, etc. // You CAN use concat, push, pop, etc. but do not use the exact method that you are replicating -// You can use the functions that you have already written to help solve the other problems +// You can use the functions that you have already written for the other problems const each = (elements, cb) => { // Iterates over a list of elements, yielding each in turn to the `cb` function. // This only needs to work with arrays. // based off http://underscorejs.org/#each + for (let i = 0; i < elements.length; i++) { + cb(elements[i], i); + } }; - +// each([1, 2, 3]), (item, index) =>{ + // console.log(`${item} @ ${index}`) const map = (elements, cb) => { // Produces a new array of values by mapping each value in list through a transformation function (iteratee). // Return the new array. + const newArray = []; + each(elements, (item, index) => { + newArray.push(cb(item, index)); + }); + return newArray; }; const reduce = (elements, cb, memo = elements.shift()) => { // Combine all elements into a single value going from left to right. // Elements will be passed one by one into `cb`. // `memo` is the starting value. If `memo` is undefined then make `elements[0]` the initial value. + let considerFirst = true; + if (arguments.length < 3) { + memo = elements[0]; + considerFirst = false; + } + each(elements, (element, index) => { + if (index > 0 || considerFirst) { + memo = cb(memo, element, index); + } + }); + return memo; }; + const find = (elements, cb) => { // Look through each value in `elements` and pass each element to `cb`. // If `cb` returns `true` then return that element. // Return `undefined` if no elements pass the truth test. + return elements.filter(cb)[0]; }; -const filter = (elements, cb) => { +const filter = (elements, test, cb) => { // Similar to `find` but you will return an array of all elements that passed the truth test // Return an empty array if no elements pass the truth test + // define an empty array + // for each item in the collection array + // if the item passed in the function returns true + // push the item into the defined array + // return the defined array + const filtered = []; + each(elements, (item) => { + if (test(item) === true) { + filtered.push(item); + } + }); + return filtered; }; /* Extra Credit */ +// Flattens a nested array (the nesting can be to any depth). +// Example: flatten([1, [2], [3, [[4]]]]); => [1, 2, 3, 4]; const flatten = (elements) => { - // Flattens a nested array (the nesting can be to any depth). - // Example: flatten([1, [2], [3, [[4]]]]); => [1, 2, 3, 4]; + let ret = []; + for (let i = 0; i < elements.length; i++) { + if (Array.isArray(elements[i])) { + ret = ret.concat(flatten(elements[i])); + } else { + ret.push(elements[i]); + } + } + return ret; }; +flatten([[[[[0]], [1]], [[[2], [3]]], [[4], [5]]]]); + /* eslint-enable no-unused-vars, max-len */ diff --git a/src/class.js b/src/class.js index 8276e29..b2d75d3 100644 --- a/src/class.js +++ b/src/class.js @@ -6,8 +6,21 @@ // for a potential password that will be compared to the `password` property. // Return true if the potential password matches the `password` property. Otherwise return false. +class User { + constructor(options) { + this.email = options.email; + this.password = options.password; + } -/* eslint-disable no-undef */ // Remove this comment once you write your classes. + comparePasswords(password) { + if (password === this.password) { + return true; + } + return false; + } + +} +/* eslint-disable no-undef */ // Create a class called `Animal` and a class called `Cat`. @@ -15,10 +28,39 @@ // Animal and Cat should both have a parameter called `options` in their constructors. // Animal should have the property `age` that's set in the constructor and the method // `growOlder` that returns the age. + // Cat should have the property `name` that is set in the constructor and the method // `meow` that should return the string ` meowed!` where `` is the `name` // property set on the Cat instance. +class Animal { + constructor(options) { + this.name = options.name; + this.age = options.age; + } + growOlder() { + return this.age += 1; + } +} +class Cat extends Animal { + constructor(options) { + super(options); + this.name = options.name; + } + meow() { + console.log(`${this.name} meowed!`); + } +} + +const animal = new Animal({ age: 1 }); + +const cat = new Cat({ + age: 1, + name: 'El Gato' +}); +console.log(cat.growOlder()); +cat.meow(); +console.log(cat.growOlder()); module.exports = { User, diff --git a/src/closure.js b/src/closure.js index 2d6592f..9fb1943 100644 --- a/src/closure.js +++ b/src/closure.js @@ -5,27 +5,59 @@ const counter = () => { // Example: const newCounter = counter(); // newCounter(); // 1 // newCounter(); // 2 + let count = 0; + return () => { + return ++count; + }; }; const counterFactory = () => { // Return an object that has two methods called `increment` and `decrement`. // `increment` should increment a counter variable in closure scope and return it. // `decrement` should decrement the counter variable and return it. + let count = 0; + return { + increment: () => { return ++count; }, + decrement: () => { return --count; }, + }; }; const limitFunctionCallCount = (cb, n) => { // Should return a function that invokes `cb`. // The returned function should only allow `cb` to be invoked `n` times. + let count = 0; + return (...args) => { + if (count === n) return null; + count += 1; + return cb(...args); + }; }; /* Extra Credit */ const cacheFunction = (cb) => { - // Should return a funciton that invokes `cb`. + // Should return a function that invokes `cb`. // A cache (object) should be kept in closure scope. // The cache should keep track of all arguments have been used to invoke this function. // If the returned function is invoked with arguments that it has already seen // then it should return the cached result and not invoke `cb` again. // `cb` should only ever be invoked once for a given set of arguments. + const cache = {}; + /* return (args) => { + const cacheKey = args.toString(); + if (!(cacheKey in cache)) { + cache[cacheKey] = cb(args); + } + return cache[cacheKey]; + }; +}; */ + return (input) => { + // if input is already cached, don't do it + if (Object.prototype.hasOwnProperty.call(cache, input)) return cache[input]; + // const something = Object.prototype.hasOwnProperty.call( , ); + // if (something) return cache[input]; + cache[input] = cb(input); + return cache[input]; + }; }; /* eslint-enable no-unused-vars */ diff --git a/src/es6.js b/src/es6.js index eb846ab..310489d 100644 --- a/src/es6.js +++ b/src/es6.js @@ -7,19 +7,19 @@ //---------------- // const, =>, default parameters, arrow functions default return statements using () -var food = 'pineapple'; +const food = 'pineapple'; -var isMyFavoriteFood = function(food) { +let isMyFavoriteFood = function(food) { food = food || 'thousand-year-old egg'; //This sets a default value if `food` is falsey return food === 'thousand-year-old egg'; }; -var isThisMyFavorite = isMyFavoriteFood(food); +const isThisMyFavorite = isMyFavoriteFood(food); //---------------- //const, class, template literals, enhanced object literals (foo: foo, -> foo,) -var User = function(options) { +const User = function(options) { this.username = options.username; this.password = options.password; this.sayHi = function() { @@ -27,10 +27,10 @@ var User = function(options) { }; } -var username = 'JavaScriptForever'; -var password = 'password'; +let username = 'JavaScriptForever'; +let password = 'password'; -var me = new User({ +const me = new User({ username: username, password: password, }); @@ -38,19 +38,19 @@ var me = new User({ // ---------------- // let, const, =>, ... (spread operator) -var addArgs = function () { - var sum = 0; - for (var i = 0; i < arguments.length; i++) { +const addArgs = function () { + let sum = 0; + for (let i = 0; i < arguments.length; i++) { sum += arguments[i]; } return sum; }; -var argsToCb = function (cb) { - var args = Array.prototype.slice.call(arguments); +const argsToCb = function (cb) { + let args = Array.prototype.slice.call(arguments); return cb.apply(null, args.splice(1)); }; -var result = argsToCb(addArgs, 1, 2, 3, 4, 5); //result should be 15 +const result = argsToCb(addArgs, 1, 2, 3, 4, 5); //result should be 15 /* eslint-enable */ diff --git a/src/objects.js b/src/objects.js index ba39c6c..3ccddaa 100644 --- a/src/objects.js +++ b/src/objects.js @@ -1,25 +1,46 @@ // Complete the following underscore functions. // Reference http://underscorejs.org/ for examples. +const each = (elements, cb) => { + // Iterates over a list of elements, yielding each in turn to the 'cb' function. + // This only needs to work with arrays. + // based off http://underscorejs.org/#each + for (let i = 0; i < elements.length; i++) { + cb(elements[i], i); + } +}; + const keys = (obj) => { // Retrieve all the names of the object's properties. // Return the keys as strings in an array. // Based on http://underscorejs.org/#keys + const newObj = Object.keys(obj); + return newObj; + // Ryan going over these in today video Sept 11 copy then delete this comment }; const values = (obj) => { // Return all of the values of the object's own properties. // Ignore functions // http://underscorejs.org/#values + const newObj = Object.values(obj); + return Object.values(newObj); }; const mapObject = (obj, cb) => { - // Like map for arrays, but for objects. Transform the value of each property in turn. + // Like map for arrays, but for objects. Transform the value of + // each property in turn. // http://underscorejs.org/#mapObject + const arrayOfKeys = Object.keys(obj); + each(arrayOfKeys, (key) => { + obj[key] = cb(obj[key]); + }); + return obj; }; const pairs = (obj) => { // Convert an object into a list of [key, value] pairs. + return Object.entries(obj); // http://underscorejs.org/#pairs }; @@ -27,14 +48,31 @@ const invert = (obj) => { // Returns a copy of the object where the keys have become the values and the values the keys. // Assume that all of the object's values will be unique and string serializable. // http://underscorejs.org/#invert + // return obj; + const result = {}; + const newKeys = Object.keys(obj); + for (let i = 0, length = newKeys.length; i < length; i++) { + if (result[obj[newKeys[i]]] instanceof Array) { + result[obj[newKeys[i]]].push(newKeys[i]); + } else if (result[obj[newKeys[i]]]) { + const temp = result[obj[newKeys[i]]]; + result[obj[newKeys[i]]] = [temp, newKeys[i]]; + } else { + result[obj[newKeys[i]]] = newKeys[i]; + } + } + return result; }; const defaults = (obj, defaultProps) => { - // Fill in undefined properties that match properties on the `defaultProps` parameter object. - // Return `obj`. - // http://underscorejs.org/#defaults +// Fill in undefined properties that match properties on the +// `defaultProps` parameter object. +// http://underscorejs.org/#defaults + Object.keys(defaultProps).forEach((key) => { + obj[key] = obj[key] || defaultProps[key]; + }); + return obj; }; - /* eslint-enable no-unused-vars */ module.exports = { diff --git a/src/recursion.js b/src/recursion.js index eb65c57..96c48d7 100644 --- a/src/recursion.js +++ b/src/recursion.js @@ -3,19 +3,51 @@ const nFibonacci = (n) => { // fibonacci sequence: 1 2 3 5 8 13 ... // return the nth number in the sequence + if (n < 2) { + return 1; + } + return nFibonacci(n - 2) + nFibonacci(n - 1); }; const nFactorial = (n) => { - // factorial example: !5 = 5 * 4 * 3 * 2 * 1 - // return the factorial of `n` + if (n === 0) { + return 1; + } + if (n < 0) { + return undefined; + } + for (let i = n; --i;) { + n *= i; + } + return n; }; /* Extra Credit */ const checkMatchingLeaves = (obj) => { // return true if every property on `obj` is the same // otherwise return false + let leaf = ''; + let leavesMatch = true; + const checkForMatches = (tree) => { + Object.keys(tree).forEach((key) => { + if (leaf === '' && typeof key !== 'object') { + leaf = tree[key]; + return undefined; + } + if (typeof tree[key] === 'object') { + return checkForMatches(tree[key]); + } + if (tree[key] !== leaf) { + leavesMatch = false; + return undefined; + } + return undefined; + }); + }; + checkForMatches(obj); + return leavesMatch; }; - +checkMatchingLeaves({ a: 1, b: 1, c: { ca: 1, } }); /* eslint-enable no-unused-vars */ module.exports = { diff --git a/src/this.js b/src/this.js index 8ea3020..6db73ed 100644 --- a/src/this.js +++ b/src/this.js @@ -4,17 +4,21 @@ class User { constructor(options) { + this.username = options.username; + this.password = options.password; + this.checkPassword = string => string === this.password; + } // set a username and password property on the user object that is created } // 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` -} - const me = new User({ username: 'LambdaSchool', password: 'correcthorsebatterystaple' }); const result = me.checkPassword('correcthorsebatterystaple'); // should return `true` +console.log(result); const checkPassword = function comparePasswords(passwordToCompare) { + this.checkPassword(passwordToCompare); // recreate the `checkPassword` method that you made on the `User` class // use `this` to access the object's `password` property. // do not modify this function's parameters @@ -25,7 +29,10 @@ const checkPassword = function comparePasswords(passwordToCompare) { // use .call, .apply, and .bind // .call +console.log(checkPassword.call(me, 'correcthorsebatterystaple')); // .apply - +console.log(checkPassword.apply(me, ['correcthorsebatterystaple'])); // .bind +const checkCheck = me.checkPassword.bind(me); +console.log(checkCheck('correcthorsebatterystaple'));