├── .gitattributes ├── .gitignore ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── additional_content └── new_features │ ├── 01-babel-get-started │ ├── babel.config.json │ ├── dist.js │ ├── index.html │ ├── index.js │ ├── package.json │ └── yarn.lock │ └── 02-tuple │ ├── babel.config.json │ ├── dist.js │ ├── index.html │ ├── index.js │ ├── package.json │ └── yarn.lock ├── chapter1 ├── conditions.js ├── example1 │ ├── index.html │ └── index.js ├── functions.js ├── operators.js └── variables.js ├── chapter10 ├── generator1.js ├── generator2.js ├── generator3.js ├── generator4.js ├── generator5.js ├── generator6.js ├── generator7.js ├── generator8.js ├── generator9.js ├── iterable1.js ├── iterable2.js ├── iterator1.js ├── iterator2.js ├── json1.json ├── json2.js ├── json3.js ├── json4.js ├── map1.js ├── proxy1.js ├── proxy2.js ├── proxy3.js ├── proxy4.js ├── proxy5.js ├── random1.js ├── symbol_match1.js ├── symbol_species1.js ├── symbol_toPrimitive1.js ├── typed_array1.js └── typed_array2.js ├── chapter11 ├── exception1.js ├── exception2.js ├── exception3.js ├── exception4.js ├── exception5.js ├── exception6.js └── exception7.js ├── chapter12 ├── async1.js ├── async2.js ├── async3.js ├── async_generator1.js ├── async_generator2.js ├── async_generator3.js ├── async_generator4.js ├── async_iterator1.js ├── event_loop1.js ├── event_loop2.js ├── event_loop3.js ├── event_loop4.js ├── promise1.js ├── promise2.js ├── promise3.js ├── promise4.js ├── promise5.js ├── promise5_1.js ├── promise6.js ├── promise_all1.js ├── promise_all2.js ├── promise_allSettled1.js ├── promise_any1.js └── promise_sequential1.js ├── chapter13 ├── example2 │ ├── add.js │ ├── index.html │ ├── index.js │ ├── package.json │ └── print.js ├── example3 │ ├── button.js │ ├── form │ │ ├── index.js │ │ ├── input.js │ │ ├── radio.js │ │ └── select.js │ ├── index.js │ ├── module1.js │ ├── module2.js │ ├── module3.js │ ├── package.json │ └── sum.js ├── example4 │ ├── index.js │ └── posts.js └── module1.js ├── chapter14 ├── online-clothing-store │ ├── Address.js │ ├── Cart.js │ ├── Clothing.js │ ├── Jeans.js │ ├── Order.js │ ├── Store.js │ ├── TShirt.js │ ├── User.js │ ├── index.html │ ├── index.js │ ├── package.json │ └── utils.js └── super-array │ ├── index.js │ ├── package.json │ ├── src │ ├── count_values.js │ ├── difference.js │ ├── difference_symm.js │ ├── intersection.js │ ├── mean.js │ ├── range.js │ ├── split.js │ ├── sum.js │ ├── union.js │ └── unique.js │ └── test.js ├── chapter2 ├── comment1.js ├── comment2.js ├── comment3.js ├── object1.js ├── string1.js ├── symbol1.js └── symbol2.js ├── chapter3 ├── addition1.js ├── comparison1.js ├── comparison2.js ├── comparison3.js ├── comparison4.js ├── logical1.js └── substraction1.js ├── chapter4 ├── continue1.js ├── for1.js ├── for2.js ├── ifelse1.js ├── ifelse2.js ├── ifelse3.js ├── ifelseifelse1.js ├── label1.js ├── label2.js ├── switchcase1.js └── while1.js ├── chapter5 ├── callback1.js ├── closure1.js ├── closure2.js ├── closure_for_loop1.js ├── closure_inc1.js ├── closure_inc2.js ├── closure_inc3.js ├── currying1.js ├── higher_order_func1.js ├── hoisting1.js ├── memoization1.js ├── memoization2.js ├── memoization3.js ├── optional_params1.js ├── optional_params2.js ├── pure_function1.js ├── recursion1.js ├── scope1.js ├── scope2.js ├── scope3.js ├── varargs1.js └── varargs2.js ├── chapter6 ├── array1.js ├── array2.js ├── array_da1.js ├── array_da2.js └── array_sort1.js ├── chapter7 ├── apply1.js ├── array_like1.js ├── bind1.js ├── bind2.js ├── bind3.js ├── byvalue_byref1.js ├── call1.js ├── call2.js ├── computed_property_names1.js ├── constructor1.js ├── constructor2.js ├── constructor3.js ├── da_rest1.js ├── da_rest2.js ├── descriptor1.js ├── descriptor2.js ├── descriptor3.js ├── getters_setters1.js ├── getters_setters2.js ├── iterating_properties1.js ├── iterating_properties2.js ├── object1.js ├── object2.js ├── object3.js ├── object_create1.js ├── prototype1.js ├── seal1.js ├── this1.js ├── this2.js ├── this3.js ├── toString1.js ├── valueOf1.js └── with1.js ├── chapter8 ├── abstract_class1.js ├── abstract_class2.js ├── composition1.js ├── constructor1.js ├── inheritance1.js ├── inheritance2.js ├── inheritance3.js ├── inheritance4.js ├── methods1.js ├── methods2.js ├── private_fields1.js ├── public_fields1.js ├── public_fields2.js ├── static_fields1.js ├── static_fields2.js ├── static_fields3.js └── static_fields4.js ├── chapter9 ├── regexp1.js ├── regexp2.js ├── regexp3.js ├── regexp4.js ├── string1.js ├── string2.js ├── string3.js ├── string4.js └── tagged_templates1.js └── index.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | 106 | .DS_Store -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "liveServer.settings.port": 5501 3 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Xuqian Zhang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # javascript-book-examples 2 | JavaScript 基础语法详解随书示例代码 3 | -------------------------------------------------------------------------------- /additional_content/new_features/01-babel-get-started/babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"], 3 | "plugins": [["@babel/plugin-proposal-decorators", { "version": "2021-12"}]] 4 | } -------------------------------------------------------------------------------- /additional_content/new_features/01-babel-get-started/dist.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 4 | 5 | var _initClass; 6 | 7 | function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 8 | 9 | function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 10 | 11 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 12 | 13 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 14 | 15 | function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 16 | 17 | function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 18 | 19 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 20 | 21 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 22 | 23 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 24 | 25 | function createMetadataMethodsForProperty(metadataMap, kind, property, decoratorFinishedRef) { return { getMetadata: function getMetadata(key) { assertNotFinished(decoratorFinishedRef, "getMetadata"), assertMetadataKey(key); var metadataForKey = metadataMap[key]; if (void 0 !== metadataForKey) if (1 === kind) { var pub = metadataForKey["public"]; if (void 0 !== pub) return pub[property]; } else if (2 === kind) { var priv = metadataForKey["private"]; if (void 0 !== priv) return priv.get(property); } else if (Object.hasOwnProperty.call(metadataForKey, "constructor")) return metadataForKey.constructor; }, setMetadata: function setMetadata(key, value) { assertNotFinished(decoratorFinishedRef, "setMetadata"), assertMetadataKey(key); var metadataForKey = metadataMap[key]; if (void 0 === metadataForKey && (metadataForKey = metadataMap[key] = {}), 1 === kind) { var pub = metadataForKey["public"]; void 0 === pub && (pub = metadataForKey["public"] = {}), pub[property] = value; } else if (2 === kind) { var priv = metadataForKey.priv; void 0 === priv && (priv = metadataForKey["private"] = new Map()), priv.set(property, value); } else metadataForKey.constructor = value; } }; } 26 | 27 | function convertMetadataMapToFinal(obj, metadataMap) { var parentMetadataMap = obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")], metadataKeys = Object.getOwnPropertySymbols(metadataMap); if (0 !== metadataKeys.length) { for (var i = 0; i < metadataKeys.length; i++) { var key = metadataKeys[i], metaForKey = metadataMap[key], parentMetaForKey = parentMetadataMap ? parentMetadataMap[key] : null, pub = metaForKey["public"], parentPub = parentMetaForKey ? parentMetaForKey["public"] : null; pub && parentPub && Object.setPrototypeOf(pub, parentPub); var priv = metaForKey["private"]; if (priv) { var privArr = Array.from(priv.values()), parentPriv = parentMetaForKey ? parentMetaForKey["private"] : null; parentPriv && (privArr = privArr.concat(parentPriv)), metaForKey["private"] = privArr; } parentMetaForKey && Object.setPrototypeOf(metaForKey, parentMetaForKey); } parentMetadataMap && Object.setPrototypeOf(metadataMap, parentMetadataMap), obj[Symbol.metadata || Symbol["for"]("Symbol.metadata")] = metadataMap; } } 28 | 29 | function createAddInitializerMethod(initializers, decoratorFinishedRef) { return function (initializer) { assertNotFinished(decoratorFinishedRef, "addInitializer"), assertCallable(initializer, "An initializer"), initializers.push(initializer); }; } 30 | 31 | function memberDec(dec, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value) { var kindStr; switch (kind) { case 1: kindStr = "accessor"; break; case 2: kindStr = "method"; break; case 3: kindStr = "getter"; break; case 4: kindStr = "setter"; break; default: kindStr = "field"; } var metadataKind, metadataName, ctx = { kind: kindStr, name: isPrivate ? "#" + name : name, isStatic: isStatic, isPrivate: isPrivate }, decoratorFinishedRef = { v: !1 }; if (0 !== kind && (ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef)), isPrivate) { metadataKind = 2, metadataName = Symbol(name); var access = {}; 0 === kind ? (access.get = desc.get, access.set = desc.set) : 2 === kind ? access.get = function () { return desc.value; } : (1 !== kind && 3 !== kind || (access.get = function () { return desc.get.call(this); }), 1 !== kind && 4 !== kind || (access.set = function (v) { desc.set.call(this, v); })), ctx.access = access; } else metadataKind = 1, metadataName = name; try { return dec(value, Object.assign(ctx, createMetadataMethodsForProperty(metadataMap, metadataKind, metadataName, decoratorFinishedRef))); } finally { decoratorFinishedRef.v = !0; } } 32 | 33 | function assertNotFinished(decoratorFinishedRef, fnName) { if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished"); } 34 | 35 | function assertMetadataKey(key) { if ("symbol" != _typeof(key)) throw new TypeError("Metadata keys must be symbols, received: " + key); } 36 | 37 | function assertCallable(fn, hint) { if ("function" != typeof fn) throw new TypeError(hint + " must be a function"); } 38 | 39 | function assertValidReturnValue(kind, value) { var type = _typeof(value); if (1 === kind) { if ("object" !== type || null === value) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); void 0 !== value.get && assertCallable(value.get, "accessor.get"), void 0 !== value.set && assertCallable(value.set, "accessor.set"), void 0 !== value.init && assertCallable(value.init, "accessor.init"), void 0 !== value.initializer && assertCallable(value.initializer, "accessor.initializer"); } else if ("function" !== type) { var hint; throw hint = 0 === kind ? "field" : 10 === kind ? "class" : "method", new TypeError(hint + " decorators must return a function or void 0"); } } 40 | 41 | function getInit(desc) { var initializer; return null == (initializer = desc.init) && (initializer = desc.initializer) && "undefined" != typeof console && console.warn(".initializer has been renamed to .init as of March 2022"), initializer; } 42 | 43 | function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers) { var desc, initializer, value, newValue, get, set, decs = decInfo[0]; if (isPrivate ? desc = 0 === kind || 1 === kind ? { get: decInfo[3], set: decInfo[4] } : 3 === kind ? { get: decInfo[3] } : 4 === kind ? { set: decInfo[3] } : { value: decInfo[3] } : 0 !== kind && (desc = Object.getOwnPropertyDescriptor(base, name)), 1 === kind ? value = { get: desc.get, set: desc.set } : 2 === kind ? value = desc.value : 3 === kind ? value = desc.get : 4 === kind && (value = desc.set), "function" == typeof decs) void 0 !== (newValue = memberDec(decs, name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value)) && (assertValidReturnValue(kind, newValue), 0 === kind ? initializer = newValue : 1 === kind ? (initializer = getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = { get: get, set: set }) : value = newValue);else for (var i = decs.length - 1; i >= 0; i--) { var newInit; if (void 0 !== (newValue = memberDec(decs[i], name, desc, metadataMap, initializers, kind, isStatic, isPrivate, value))) assertValidReturnValue(kind, newValue), 0 === kind ? newInit = newValue : 1 === kind ? (newInit = getInit(newValue), get = newValue.get || value.get, set = newValue.set || value.set, value = { get: get, set: set }) : value = newValue, void 0 !== newInit && (void 0 === initializer ? initializer = newInit : "function" == typeof initializer ? initializer = [initializer, newInit] : initializer.push(newInit)); } if (0 === kind || 1 === kind) { if (void 0 === initializer) initializer = function initializer(instance, init) { return init; };else if ("function" != typeof initializer) { var ownInitializers = initializer; initializer = function initializer(instance, init) { for (var value = init, i = 0; i < ownInitializers.length; i++) { value = ownInitializers[i].call(instance, value); } return value; }; } else { var originalInitializer = initializer; initializer = function initializer(instance, init) { return originalInitializer.call(instance, init); }; } ret.push(initializer); } 0 !== kind && (1 === kind ? (desc.get = value.get, desc.set = value.set) : 2 === kind ? desc.value = value : 3 === kind ? desc.get = value : 4 === kind && (desc.set = value), isPrivate ? 1 === kind ? (ret.push(function (instance, args) { return value.get.call(instance, args); }), ret.push(function (instance, args) { return value.set.call(instance, args); })) : 2 === kind ? ret.push(value) : ret.push(function (instance, args) { return value.call(instance, args); }) : Object.defineProperty(base, name, desc)); } 44 | 45 | function applyMemberDecs(ret, Class, protoMetadataMap, staticMetadataMap, decInfos) { for (var protoInitializers, staticInitializers, existingProtoNonFields = new Map(), existingStaticNonFields = new Map(), i = 0; i < decInfos.length; i++) { var decInfo = decInfos[i]; if (Array.isArray(decInfo)) { var base, metadataMap, initializers, kind = decInfo[1], name = decInfo[2], isPrivate = decInfo.length > 3, isStatic = kind >= 5; if (isStatic ? (base = Class, metadataMap = staticMetadataMap, 0 !== (kind -= 5) && (initializers = staticInitializers = staticInitializers || [])) : (base = Class.prototype, metadataMap = protoMetadataMap, 0 !== kind && (initializers = protoInitializers = protoInitializers || [])), 0 !== kind && !isPrivate) { var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields, existingKind = existingNonFields.get(name) || 0; if (!0 === existingKind || 3 === existingKind && 4 !== kind || 4 === existingKind && 3 !== kind) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name); !existingKind && kind > 2 ? existingNonFields.set(name, kind) : existingNonFields.set(name, !0); } applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, metadataMap, initializers); } } pushInitializers(ret, protoInitializers), pushInitializers(ret, staticInitializers); } 46 | 47 | function pushInitializers(ret, initializers) { initializers && ret.push(function (instance) { for (var i = 0; i < initializers.length; i++) { initializers[i].call(instance); } return instance; }); } 48 | 49 | function applyClassDecs(ret, targetClass, metadataMap, classDecs) { if (classDecs.length > 0) { for (var initializers = [], newClass = targetClass, name = targetClass.name, i = classDecs.length - 1; i >= 0; i--) { var decoratorFinishedRef = { v: !1 }; try { var ctx = Object.assign({ kind: "class", name: name, addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef) }, createMetadataMethodsForProperty(metadataMap, 0, name, decoratorFinishedRef)), nextNewClass = classDecs[i](newClass, ctx); } finally { decoratorFinishedRef.v = !0; } void 0 !== nextNewClass && (assertValidReturnValue(10, nextNewClass), newClass = nextNewClass); } ret.push(newClass, function () { for (var i = 0; i < initializers.length; i++) { initializers[i].call(newClass); } }); } } 50 | 51 | function _applyDecs(targetClass, memberDecs, classDecs) { var ret = [], staticMetadataMap = {}, protoMetadataMap = {}; return applyMemberDecs(ret, targetClass, protoMetadataMap, staticMetadataMap, memberDecs), convertMetadataMapToFinal(targetClass.prototype, protoMetadataMap), applyClassDecs(ret, targetClass, staticMetadataMap, classDecs), convertMetadataMapToFinal(targetClass, staticMetadataMap), ret; } 52 | 53 | var _TestClass; 54 | 55 | var TestClass = /*#__PURE__*/_createClass(function TestClass() { 56 | _classCallCheck(this, TestClass); 57 | }); 58 | 59 | var _applyDecs2 = _applyDecs(TestClass, [], [test]); 60 | 61 | var _applyDecs3 = _slicedToArray(_applyDecs2, 2); 62 | 63 | _TestClass = _applyDecs3[0]; 64 | _initClass = _applyDecs3[1]; 65 | 66 | _initClass(); 67 | 68 | function test(target) { 69 | console.log(target.name); 70 | } 71 | -------------------------------------------------------------------------------- /additional_content/new_features/01-babel-get-started/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /additional_content/new_features/01-babel-get-started/index.js: -------------------------------------------------------------------------------- 1 | @test 2 | class TestClass {} 3 | 4 | function test(target) { 5 | console.log(target.name); 6 | } 7 | -------------------------------------------------------------------------------- /additional_content/new_features/01-babel-get-started/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "babel-hello-world", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "scripts": { 7 | "build": "babel index.js -o dist.js" 8 | }, 9 | "devDependencies": { 10 | "@babel/cli": "^7.17.6", 11 | "@babel/core": "^7.17.8", 12 | "@babel/plugin-proposal-decorators": "^7.17.8", 13 | "@babel/preset-env": "^7.16.11" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /additional_content/new_features/01-babel-get-started/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@ampproject/remapping@^2.1.0": 6 | version "2.1.2" 7 | resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.1.2.tgz#4edca94973ded9630d20101cd8559cedb8d8bd34" 8 | integrity sha512-hoyByceqwKirw7w3Z7gnIIZC3Wx3J484Y3L/cMpXFbr7d9ZQj2mODrirNzcJa+SM3UlpWXYvKV4RlRpFXlWgXg== 9 | dependencies: 10 | "@jridgewell/trace-mapping" "^0.3.0" 11 | 12 | "@babel/cli@^7.17.6": 13 | version "7.17.6" 14 | resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.17.6.tgz#169e5935f1795f0b62ded5a2accafeedfe5c5363" 15 | integrity sha512-l4w608nsDNlxZhiJ5tE3DbNmr61fIKMZ6fTBo171VEFuFMIYuJ3mHRhTLEkKKyvx2Mizkkv/0a8OJOnZqkKYNA== 16 | dependencies: 17 | "@jridgewell/trace-mapping" "^0.3.4" 18 | commander "^4.0.1" 19 | convert-source-map "^1.1.0" 20 | fs-readdir-recursive "^1.1.0" 21 | glob "^7.0.0" 22 | make-dir "^2.1.0" 23 | slash "^2.0.0" 24 | source-map "^0.5.0" 25 | optionalDependencies: 26 | "@nicolo-ribaudo/chokidar-2" "2.1.8-no-fsevents.3" 27 | chokidar "^3.4.0" 28 | 29 | "@babel/code-frame@^7.16.7": 30 | version "7.16.7" 31 | resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" 32 | integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== 33 | dependencies: 34 | "@babel/highlight" "^7.16.7" 35 | 36 | "@babel/compat-data@^7.13.11", "@babel/compat-data@^7.16.8", "@babel/compat-data@^7.17.0", "@babel/compat-data@^7.17.7": 37 | version "7.17.7" 38 | resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.17.7.tgz#078d8b833fbbcc95286613be8c716cef2b519fa2" 39 | integrity sha512-p8pdE6j0a29TNGebNm7NzYZWB3xVZJBZ7XGs42uAKzQo8VQ3F0By/cQCtUEABwIqw5zo6WA4NbmxsfzADzMKnQ== 40 | 41 | "@babel/core@^7.17.8": 42 | version "7.17.8" 43 | resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.17.8.tgz#3dac27c190ebc3a4381110d46c80e77efe172e1a" 44 | integrity sha512-OdQDV/7cRBtJHLSOBqqbYNkOcydOgnX59TZx4puf41fzcVtN3e/4yqY8lMQsK+5X2lJtAdmA+6OHqsj1hBJ4IQ== 45 | dependencies: 46 | "@ampproject/remapping" "^2.1.0" 47 | "@babel/code-frame" "^7.16.7" 48 | "@babel/generator" "^7.17.7" 49 | "@babel/helper-compilation-targets" "^7.17.7" 50 | "@babel/helper-module-transforms" "^7.17.7" 51 | "@babel/helpers" "^7.17.8" 52 | "@babel/parser" "^7.17.8" 53 | "@babel/template" "^7.16.7" 54 | "@babel/traverse" "^7.17.3" 55 | "@babel/types" "^7.17.0" 56 | convert-source-map "^1.7.0" 57 | debug "^4.1.0" 58 | gensync "^1.0.0-beta.2" 59 | json5 "^2.1.2" 60 | semver "^6.3.0" 61 | 62 | "@babel/generator@^7.17.3", "@babel/generator@^7.17.7": 63 | version "7.17.7" 64 | resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.17.7.tgz#8da2599beb4a86194a3b24df6c085931d9ee45ad" 65 | integrity sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w== 66 | dependencies: 67 | "@babel/types" "^7.17.0" 68 | jsesc "^2.5.1" 69 | source-map "^0.5.0" 70 | 71 | "@babel/helper-annotate-as-pure@^7.16.7": 72 | version "7.16.7" 73 | resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.7.tgz#bb2339a7534a9c128e3102024c60760a3a7f3862" 74 | integrity sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw== 75 | dependencies: 76 | "@babel/types" "^7.16.7" 77 | 78 | "@babel/helper-builder-binary-assignment-operator-visitor@^7.16.7": 79 | version "7.16.7" 80 | resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.16.7.tgz#38d138561ea207f0f69eb1626a418e4f7e6a580b" 81 | integrity sha512-C6FdbRaxYjwVu/geKW4ZeQ0Q31AftgRcdSnZ5/jsH6BzCJbtvXvhpfkbkThYSuutZA7nCXpPR6AD9zd1dprMkA== 82 | dependencies: 83 | "@babel/helper-explode-assignable-expression" "^7.16.7" 84 | "@babel/types" "^7.16.7" 85 | 86 | "@babel/helper-compilation-targets@^7.13.0", "@babel/helper-compilation-targets@^7.16.7", "@babel/helper-compilation-targets@^7.17.7": 87 | version "7.17.7" 88 | resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.17.7.tgz#a3c2924f5e5f0379b356d4cfb313d1414dc30e46" 89 | integrity sha512-UFzlz2jjd8kroj0hmCFV5zr+tQPi1dpC2cRsDV/3IEW8bJfCPrPpmcSN6ZS8RqIq4LXcmpipCQFPddyFA5Yc7w== 90 | dependencies: 91 | "@babel/compat-data" "^7.17.7" 92 | "@babel/helper-validator-option" "^7.16.7" 93 | browserslist "^4.17.5" 94 | semver "^6.3.0" 95 | 96 | "@babel/helper-create-class-features-plugin@^7.16.10", "@babel/helper-create-class-features-plugin@^7.16.7", "@babel/helper-create-class-features-plugin@^7.17.6": 97 | version "7.17.6" 98 | resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.17.6.tgz#3778c1ed09a7f3e65e6d6e0f6fbfcc53809d92c9" 99 | integrity sha512-SogLLSxXm2OkBbSsHZMM4tUi8fUzjs63AT/d0YQIzr6GSd8Hxsbk2KYDX0k0DweAzGMj/YWeiCsorIdtdcW8Eg== 100 | dependencies: 101 | "@babel/helper-annotate-as-pure" "^7.16.7" 102 | "@babel/helper-environment-visitor" "^7.16.7" 103 | "@babel/helper-function-name" "^7.16.7" 104 | "@babel/helper-member-expression-to-functions" "^7.16.7" 105 | "@babel/helper-optimise-call-expression" "^7.16.7" 106 | "@babel/helper-replace-supers" "^7.16.7" 107 | "@babel/helper-split-export-declaration" "^7.16.7" 108 | 109 | "@babel/helper-create-regexp-features-plugin@^7.16.7": 110 | version "7.17.0" 111 | resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.17.0.tgz#1dcc7d40ba0c6b6b25618997c5dbfd310f186fe1" 112 | integrity sha512-awO2So99wG6KnlE+TPs6rn83gCz5WlEePJDTnLEqbchMVrBeAujURVphRdigsk094VhvZehFoNOihSlcBjwsXA== 113 | dependencies: 114 | "@babel/helper-annotate-as-pure" "^7.16.7" 115 | regexpu-core "^5.0.1" 116 | 117 | "@babel/helper-define-polyfill-provider@^0.3.1": 118 | version "0.3.1" 119 | resolved "https://registry.yarnpkg.com/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.1.tgz#52411b445bdb2e676869e5a74960d2d3826d2665" 120 | integrity sha512-J9hGMpJQmtWmj46B3kBHmL38UhJGhYX7eqkcq+2gsstyYt341HmPeWspihX43yVRA0mS+8GGk2Gckc7bY/HCmA== 121 | dependencies: 122 | "@babel/helper-compilation-targets" "^7.13.0" 123 | "@babel/helper-module-imports" "^7.12.13" 124 | "@babel/helper-plugin-utils" "^7.13.0" 125 | "@babel/traverse" "^7.13.0" 126 | debug "^4.1.1" 127 | lodash.debounce "^4.0.8" 128 | resolve "^1.14.2" 129 | semver "^6.1.2" 130 | 131 | "@babel/helper-environment-visitor@^7.16.7": 132 | version "7.16.7" 133 | resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.7.tgz#ff484094a839bde9d89cd63cba017d7aae80ecd7" 134 | integrity sha512-SLLb0AAn6PkUeAfKJCCOl9e1R53pQlGAfc4y4XuMRZfqeMYLE0dM1LMhqbGAlGQY0lfw5/ohoYWAe9V1yibRag== 135 | dependencies: 136 | "@babel/types" "^7.16.7" 137 | 138 | "@babel/helper-explode-assignable-expression@^7.16.7": 139 | version "7.16.7" 140 | resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.7.tgz#12a6d8522fdd834f194e868af6354e8650242b7a" 141 | integrity sha512-KyUenhWMC8VrxzkGP0Jizjo4/Zx+1nNZhgocs+gLzyZyB8SHidhoq9KK/8Ato4anhwsivfkBLftky7gvzbZMtQ== 142 | dependencies: 143 | "@babel/types" "^7.16.7" 144 | 145 | "@babel/helper-function-name@^7.16.7": 146 | version "7.16.7" 147 | resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz#f1ec51551fb1c8956bc8dd95f38523b6cf375f8f" 148 | integrity sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA== 149 | dependencies: 150 | "@babel/helper-get-function-arity" "^7.16.7" 151 | "@babel/template" "^7.16.7" 152 | "@babel/types" "^7.16.7" 153 | 154 | "@babel/helper-get-function-arity@^7.16.7": 155 | version "7.16.7" 156 | resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz#ea08ac753117a669f1508ba06ebcc49156387419" 157 | integrity sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw== 158 | dependencies: 159 | "@babel/types" "^7.16.7" 160 | 161 | "@babel/helper-hoist-variables@^7.16.7": 162 | version "7.16.7" 163 | resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.7.tgz#86bcb19a77a509c7b77d0e22323ef588fa58c246" 164 | integrity sha512-m04d/0Op34H5v7pbZw6pSKP7weA6lsMvfiIAMeIvkY/R4xQtBSMFEigu9QTZ2qB/9l22vsxtM8a+Q8CzD255fg== 165 | dependencies: 166 | "@babel/types" "^7.16.7" 167 | 168 | "@babel/helper-member-expression-to-functions@^7.16.7": 169 | version "7.17.7" 170 | resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.17.7.tgz#a34013b57d8542a8c4ff8ba3f747c02452a4d8c4" 171 | integrity sha512-thxXgnQ8qQ11W2wVUObIqDL4p148VMxkt5T/qpN5k2fboRyzFGFmKsTGViquyM5QHKUy48OZoca8kw4ajaDPyw== 172 | dependencies: 173 | "@babel/types" "^7.17.0" 174 | 175 | "@babel/helper-module-imports@^7.12.13", "@babel/helper-module-imports@^7.16.7": 176 | version "7.16.7" 177 | resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz#25612a8091a999704461c8a222d0efec5d091437" 178 | integrity sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg== 179 | dependencies: 180 | "@babel/types" "^7.16.7" 181 | 182 | "@babel/helper-module-transforms@^7.16.7", "@babel/helper-module-transforms@^7.17.7": 183 | version "7.17.7" 184 | resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.17.7.tgz#3943c7f777139e7954a5355c815263741a9c1cbd" 185 | integrity sha512-VmZD99F3gNTYB7fJRDTi+u6l/zxY0BE6OIxPSU7a50s6ZUQkHwSDmV92FfM+oCG0pZRVojGYhkR8I0OGeCVREw== 186 | dependencies: 187 | "@babel/helper-environment-visitor" "^7.16.7" 188 | "@babel/helper-module-imports" "^7.16.7" 189 | "@babel/helper-simple-access" "^7.17.7" 190 | "@babel/helper-split-export-declaration" "^7.16.7" 191 | "@babel/helper-validator-identifier" "^7.16.7" 192 | "@babel/template" "^7.16.7" 193 | "@babel/traverse" "^7.17.3" 194 | "@babel/types" "^7.17.0" 195 | 196 | "@babel/helper-optimise-call-expression@^7.16.7": 197 | version "7.16.7" 198 | resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.7.tgz#a34e3560605abbd31a18546bd2aad3e6d9a174f2" 199 | integrity sha512-EtgBhg7rd/JcnpZFXpBy0ze1YRfdm7BnBX4uKMBd3ixa3RGAE002JZB66FJyNH7g0F38U05pXmA5P8cBh7z+1w== 200 | dependencies: 201 | "@babel/types" "^7.16.7" 202 | 203 | "@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.13.0", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.16.7", "@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": 204 | version "7.16.7" 205 | resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.7.tgz#aa3a8ab4c3cceff8e65eb9e73d87dc4ff320b2f5" 206 | integrity sha512-Qg3Nk7ZxpgMrsox6HreY1ZNKdBq7K72tDSliA6dCl5f007jR4ne8iD5UzuNnCJH2xBf2BEEVGr+/OL6Gdp7RxA== 207 | 208 | "@babel/helper-remap-async-to-generator@^7.16.8": 209 | version "7.16.8" 210 | resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.16.8.tgz#29ffaade68a367e2ed09c90901986918d25e57e3" 211 | integrity sha512-fm0gH7Flb8H51LqJHy3HJ3wnE1+qtYR2A99K06ahwrawLdOFsCEWjZOrYricXJHoPSudNKxrMBUPEIPxiIIvBw== 212 | dependencies: 213 | "@babel/helper-annotate-as-pure" "^7.16.7" 214 | "@babel/helper-wrap-function" "^7.16.8" 215 | "@babel/types" "^7.16.8" 216 | 217 | "@babel/helper-replace-supers@^7.16.7": 218 | version "7.16.7" 219 | resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.16.7.tgz#e9f5f5f32ac90429c1a4bdec0f231ef0c2838ab1" 220 | integrity sha512-y9vsWilTNaVnVh6xiJfABzsNpgDPKev9HnAgz6Gb1p6UUwf9NepdlsV7VXGCftJM+jqD5f7JIEubcpLjZj5dBw== 221 | dependencies: 222 | "@babel/helper-environment-visitor" "^7.16.7" 223 | "@babel/helper-member-expression-to-functions" "^7.16.7" 224 | "@babel/helper-optimise-call-expression" "^7.16.7" 225 | "@babel/traverse" "^7.16.7" 226 | "@babel/types" "^7.16.7" 227 | 228 | "@babel/helper-simple-access@^7.17.7": 229 | version "7.17.7" 230 | resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.17.7.tgz#aaa473de92b7987c6dfa7ce9a7d9674724823367" 231 | integrity sha512-txyMCGroZ96i+Pxr3Je3lzEJjqwaRC9buMUgtomcrLe5Nd0+fk1h0LLA+ixUF5OW7AhHuQ7Es1WcQJZmZsz2XA== 232 | dependencies: 233 | "@babel/types" "^7.17.0" 234 | 235 | "@babel/helper-skip-transparent-expression-wrappers@^7.16.0": 236 | version "7.16.0" 237 | resolved "https://registry.yarnpkg.com/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.16.0.tgz#0ee3388070147c3ae051e487eca3ebb0e2e8bb09" 238 | integrity sha512-+il1gTy0oHwUsBQZyJvukbB4vPMdcYBrFHa0Uc4AizLxbq6BOYC51Rv4tWocX9BLBDLZ4kc6qUFpQ6HRgL+3zw== 239 | dependencies: 240 | "@babel/types" "^7.16.0" 241 | 242 | "@babel/helper-split-export-declaration@^7.16.7": 243 | version "7.16.7" 244 | resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz#0b648c0c42da9d3920d85ad585f2778620b8726b" 245 | integrity sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw== 246 | dependencies: 247 | "@babel/types" "^7.16.7" 248 | 249 | "@babel/helper-validator-identifier@^7.16.7": 250 | version "7.16.7" 251 | resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz#e8c602438c4a8195751243da9031d1607d247cad" 252 | integrity sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw== 253 | 254 | "@babel/helper-validator-option@^7.16.7": 255 | version "7.16.7" 256 | resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz#b203ce62ce5fe153899b617c08957de860de4d23" 257 | integrity sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ== 258 | 259 | "@babel/helper-wrap-function@^7.16.8": 260 | version "7.16.8" 261 | resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.16.8.tgz#58afda087c4cd235de92f7ceedebca2c41274200" 262 | integrity sha512-8RpyRVIAW1RcDDGTA+GpPAwV22wXCfKOoM9bet6TLkGIFTkRQSkH1nMQ5Yet4MpoXe1ZwHPVtNasc2w0uZMqnw== 263 | dependencies: 264 | "@babel/helper-function-name" "^7.16.7" 265 | "@babel/template" "^7.16.7" 266 | "@babel/traverse" "^7.16.8" 267 | "@babel/types" "^7.16.8" 268 | 269 | "@babel/helpers@^7.17.8": 270 | version "7.17.8" 271 | resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.17.8.tgz#288450be8c6ac7e4e44df37bcc53d345e07bc106" 272 | integrity sha512-QcL86FGxpfSJwGtAvv4iG93UL6bmqBdmoVY0CMCU2g+oD2ezQse3PT5Pa+jiD6LJndBQi0EDlpzOWNlLuhz5gw== 273 | dependencies: 274 | "@babel/template" "^7.16.7" 275 | "@babel/traverse" "^7.17.3" 276 | "@babel/types" "^7.17.0" 277 | 278 | "@babel/highlight@^7.16.7": 279 | version "7.16.10" 280 | resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.16.10.tgz#744f2eb81579d6eea753c227b0f570ad785aba88" 281 | integrity sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw== 282 | dependencies: 283 | "@babel/helper-validator-identifier" "^7.16.7" 284 | chalk "^2.0.0" 285 | js-tokens "^4.0.0" 286 | 287 | "@babel/parser@^7.16.7", "@babel/parser@^7.17.3", "@babel/parser@^7.17.8": 288 | version "7.17.8" 289 | resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.8.tgz#2817fb9d885dd8132ea0f8eb615a6388cca1c240" 290 | integrity sha512-BoHhDJrJXqcg+ZL16Xv39H9n+AqJ4pcDrQBGZN+wHxIysrLZ3/ECwCBUch/1zUNhnsXULcONU3Ei5Hmkfk6kiQ== 291 | 292 | "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.16.7": 293 | version "7.16.7" 294 | resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.7.tgz#4eda6d6c2a0aa79c70fa7b6da67763dfe2141050" 295 | integrity sha512-anv/DObl7waiGEnC24O9zqL0pSuI9hljihqiDuFHC8d7/bjr/4RLGPWuc8rYOff/QPzbEPSkzG8wGG9aDuhHRg== 296 | dependencies: 297 | "@babel/helper-plugin-utils" "^7.16.7" 298 | 299 | "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@^7.16.7": 300 | version "7.16.7" 301 | resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.16.7.tgz#cc001234dfc139ac45f6bcf801866198c8c72ff9" 302 | integrity sha512-di8vUHRdf+4aJ7ltXhaDbPoszdkh59AQtJM5soLsuHpQJdFQZOA4uGj0V2u/CZ8bJ/u8ULDL5yq6FO/bCXnKHw== 303 | dependencies: 304 | "@babel/helper-plugin-utils" "^7.16.7" 305 | "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" 306 | "@babel/plugin-proposal-optional-chaining" "^7.16.7" 307 | 308 | "@babel/plugin-proposal-async-generator-functions@^7.16.8": 309 | version "7.16.8" 310 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.16.8.tgz#3bdd1ebbe620804ea9416706cd67d60787504bc8" 311 | integrity sha512-71YHIvMuiuqWJQkebWJtdhQTfd4Q4mF76q2IX37uZPkG9+olBxsX+rH1vkhFto4UeJZ9dPY2s+mDvhDm1u2BGQ== 312 | dependencies: 313 | "@babel/helper-plugin-utils" "^7.16.7" 314 | "@babel/helper-remap-async-to-generator" "^7.16.8" 315 | "@babel/plugin-syntax-async-generators" "^7.8.4" 316 | 317 | "@babel/plugin-proposal-class-properties@^7.16.7": 318 | version "7.16.7" 319 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.7.tgz#925cad7b3b1a2fcea7e59ecc8eb5954f961f91b0" 320 | integrity sha512-IobU0Xme31ewjYOShSIqd/ZGM/r/cuOz2z0MDbNrhF5FW+ZVgi0f2lyeoj9KFPDOAqsYxmLWZte1WOwlvY9aww== 321 | dependencies: 322 | "@babel/helper-create-class-features-plugin" "^7.16.7" 323 | "@babel/helper-plugin-utils" "^7.16.7" 324 | 325 | "@babel/plugin-proposal-class-static-block@^7.16.7": 326 | version "7.17.6" 327 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.17.6.tgz#164e8fd25f0d80fa48c5a4d1438a6629325ad83c" 328 | integrity sha512-X/tididvL2zbs7jZCeeRJ8167U/+Ac135AM6jCAx6gYXDUviZV5Ku9UDvWS2NCuWlFjIRXklYhwo6HhAC7ETnA== 329 | dependencies: 330 | "@babel/helper-create-class-features-plugin" "^7.17.6" 331 | "@babel/helper-plugin-utils" "^7.16.7" 332 | "@babel/plugin-syntax-class-static-block" "^7.14.5" 333 | 334 | "@babel/plugin-proposal-decorators@^7.17.8": 335 | version "7.17.8" 336 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.17.8.tgz#4f0444e896bee85d35cf714a006fc5418f87ff00" 337 | integrity sha512-U69odN4Umyyx1xO1rTII0IDkAEC+RNlcKXtqOblfpzqy1C+aOplb76BQNq0+XdpVkOaPlpEDwd++joY8FNFJKA== 338 | dependencies: 339 | "@babel/helper-create-class-features-plugin" "^7.17.6" 340 | "@babel/helper-plugin-utils" "^7.16.7" 341 | "@babel/helper-replace-supers" "^7.16.7" 342 | "@babel/plugin-syntax-decorators" "^7.17.0" 343 | charcodes "^0.2.0" 344 | 345 | "@babel/plugin-proposal-dynamic-import@^7.16.7": 346 | version "7.16.7" 347 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.7.tgz#c19c897eaa46b27634a00fee9fb7d829158704b2" 348 | integrity sha512-I8SW9Ho3/8DRSdmDdH3gORdyUuYnk1m4cMxUAdu5oy4n3OfN8flDEH+d60iG7dUfi0KkYwSvoalHzzdRzpWHTg== 349 | dependencies: 350 | "@babel/helper-plugin-utils" "^7.16.7" 351 | "@babel/plugin-syntax-dynamic-import" "^7.8.3" 352 | 353 | "@babel/plugin-proposal-export-namespace-from@^7.16.7": 354 | version "7.16.7" 355 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.16.7.tgz#09de09df18445a5786a305681423ae63507a6163" 356 | integrity sha512-ZxdtqDXLRGBL64ocZcs7ovt71L3jhC1RGSyR996svrCi3PYqHNkb3SwPJCs8RIzD86s+WPpt2S73+EHCGO+NUA== 357 | dependencies: 358 | "@babel/helper-plugin-utils" "^7.16.7" 359 | "@babel/plugin-syntax-export-namespace-from" "^7.8.3" 360 | 361 | "@babel/plugin-proposal-json-strings@^7.16.7": 362 | version "7.16.7" 363 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.16.7.tgz#9732cb1d17d9a2626a08c5be25186c195b6fa6e8" 364 | integrity sha512-lNZ3EEggsGY78JavgbHsK9u5P3pQaW7k4axlgFLYkMd7UBsiNahCITShLjNQschPyjtO6dADrL24757IdhBrsQ== 365 | dependencies: 366 | "@babel/helper-plugin-utils" "^7.16.7" 367 | "@babel/plugin-syntax-json-strings" "^7.8.3" 368 | 369 | "@babel/plugin-proposal-logical-assignment-operators@^7.16.7": 370 | version "7.16.7" 371 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.16.7.tgz#be23c0ba74deec1922e639832904be0bea73cdea" 372 | integrity sha512-K3XzyZJGQCr00+EtYtrDjmwX7o7PLK6U9bi1nCwkQioRFVUv6dJoxbQjtWVtP+bCPy82bONBKG8NPyQ4+i6yjg== 373 | dependencies: 374 | "@babel/helper-plugin-utils" "^7.16.7" 375 | "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" 376 | 377 | "@babel/plugin-proposal-nullish-coalescing-operator@^7.16.7": 378 | version "7.16.7" 379 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.7.tgz#141fc20b6857e59459d430c850a0011e36561d99" 380 | integrity sha512-aUOrYU3EVtjf62jQrCj63pYZ7k6vns2h/DQvHPWGmsJRYzWXZ6/AsfgpiRy6XiuIDADhJzP2Q9MwSMKauBQ+UQ== 381 | dependencies: 382 | "@babel/helper-plugin-utils" "^7.16.7" 383 | "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" 384 | 385 | "@babel/plugin-proposal-numeric-separator@^7.16.7": 386 | version "7.16.7" 387 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.16.7.tgz#d6b69f4af63fb38b6ca2558442a7fb191236eba9" 388 | integrity sha512-vQgPMknOIgiuVqbokToyXbkY/OmmjAzr/0lhSIbG/KmnzXPGwW/AdhdKpi+O4X/VkWiWjnkKOBiqJrTaC98VKw== 389 | dependencies: 390 | "@babel/helper-plugin-utils" "^7.16.7" 391 | "@babel/plugin-syntax-numeric-separator" "^7.10.4" 392 | 393 | "@babel/plugin-proposal-object-rest-spread@^7.16.7": 394 | version "7.17.3" 395 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.17.3.tgz#d9eb649a54628a51701aef7e0ea3d17e2b9dd390" 396 | integrity sha512-yuL5iQA/TbZn+RGAfxQXfi7CNLmKi1f8zInn4IgobuCWcAb7i+zj4TYzQ9l8cEzVyJ89PDGuqxK1xZpUDISesw== 397 | dependencies: 398 | "@babel/compat-data" "^7.17.0" 399 | "@babel/helper-compilation-targets" "^7.16.7" 400 | "@babel/helper-plugin-utils" "^7.16.7" 401 | "@babel/plugin-syntax-object-rest-spread" "^7.8.3" 402 | "@babel/plugin-transform-parameters" "^7.16.7" 403 | 404 | "@babel/plugin-proposal-optional-catch-binding@^7.16.7": 405 | version "7.16.7" 406 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.16.7.tgz#c623a430674ffc4ab732fd0a0ae7722b67cb74cf" 407 | integrity sha512-eMOH/L4OvWSZAE1VkHbr1vckLG1WUcHGJSLqqQwl2GaUqG6QjddvrOaTUMNYiv77H5IKPMZ9U9P7EaHwvAShfA== 408 | dependencies: 409 | "@babel/helper-plugin-utils" "^7.16.7" 410 | "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" 411 | 412 | "@babel/plugin-proposal-optional-chaining@^7.16.7": 413 | version "7.16.7" 414 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.7.tgz#7cd629564724816c0e8a969535551f943c64c39a" 415 | integrity sha512-eC3xy+ZrUcBtP7x+sq62Q/HYd674pPTb/77XZMb5wbDPGWIdUbSr4Agr052+zaUPSb+gGRnjxXfKFvx5iMJ+DA== 416 | dependencies: 417 | "@babel/helper-plugin-utils" "^7.16.7" 418 | "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" 419 | "@babel/plugin-syntax-optional-chaining" "^7.8.3" 420 | 421 | "@babel/plugin-proposal-private-methods@^7.16.11": 422 | version "7.16.11" 423 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.11.tgz#e8df108288555ff259f4527dbe84813aac3a1c50" 424 | integrity sha512-F/2uAkPlXDr8+BHpZvo19w3hLFKge+k75XUprE6jaqKxjGkSYcK+4c+bup5PdW/7W/Rpjwql7FTVEDW+fRAQsw== 425 | dependencies: 426 | "@babel/helper-create-class-features-plugin" "^7.16.10" 427 | "@babel/helper-plugin-utils" "^7.16.7" 428 | 429 | "@babel/plugin-proposal-private-property-in-object@^7.16.7": 430 | version "7.16.7" 431 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.16.7.tgz#b0b8cef543c2c3d57e59e2c611994861d46a3fce" 432 | integrity sha512-rMQkjcOFbm+ufe3bTZLyOfsOUOxyvLXZJCTARhJr+8UMSoZmqTe1K1BgkFcrW37rAchWg57yI69ORxiWvUINuQ== 433 | dependencies: 434 | "@babel/helper-annotate-as-pure" "^7.16.7" 435 | "@babel/helper-create-class-features-plugin" "^7.16.7" 436 | "@babel/helper-plugin-utils" "^7.16.7" 437 | "@babel/plugin-syntax-private-property-in-object" "^7.14.5" 438 | 439 | "@babel/plugin-proposal-unicode-property-regex@^7.16.7", "@babel/plugin-proposal-unicode-property-regex@^7.4.4": 440 | version "7.16.7" 441 | resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.16.7.tgz#635d18eb10c6214210ffc5ff4932552de08188a2" 442 | integrity sha512-QRK0YI/40VLhNVGIjRNAAQkEHws0cswSdFFjpFyt943YmJIU1da9uW63Iu6NFV6CxTZW5eTDCrwZUstBWgp/Rg== 443 | dependencies: 444 | "@babel/helper-create-regexp-features-plugin" "^7.16.7" 445 | "@babel/helper-plugin-utils" "^7.16.7" 446 | 447 | "@babel/plugin-syntax-async-generators@^7.8.4": 448 | version "7.8.4" 449 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" 450 | integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== 451 | dependencies: 452 | "@babel/helper-plugin-utils" "^7.8.0" 453 | 454 | "@babel/plugin-syntax-class-properties@^7.12.13": 455 | version "7.12.13" 456 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" 457 | integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== 458 | dependencies: 459 | "@babel/helper-plugin-utils" "^7.12.13" 460 | 461 | "@babel/plugin-syntax-class-static-block@^7.14.5": 462 | version "7.14.5" 463 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz#195df89b146b4b78b3bf897fd7a257c84659d406" 464 | integrity sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw== 465 | dependencies: 466 | "@babel/helper-plugin-utils" "^7.14.5" 467 | 468 | "@babel/plugin-syntax-decorators@^7.17.0": 469 | version "7.17.0" 470 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.17.0.tgz#a2be3b2c9fe7d78bd4994e790896bc411e2f166d" 471 | integrity sha512-qWe85yCXsvDEluNP0OyeQjH63DlhAR3W7K9BxxU1MvbDb48tgBG+Ao6IJJ6smPDrrVzSQZrbF6donpkFBMcs3A== 472 | dependencies: 473 | "@babel/helper-plugin-utils" "^7.16.7" 474 | 475 | "@babel/plugin-syntax-dynamic-import@^7.8.3": 476 | version "7.8.3" 477 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" 478 | integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ== 479 | dependencies: 480 | "@babel/helper-plugin-utils" "^7.8.0" 481 | 482 | "@babel/plugin-syntax-export-namespace-from@^7.8.3": 483 | version "7.8.3" 484 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz#028964a9ba80dbc094c915c487ad7c4e7a66465a" 485 | integrity sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q== 486 | dependencies: 487 | "@babel/helper-plugin-utils" "^7.8.3" 488 | 489 | "@babel/plugin-syntax-json-strings@^7.8.3": 490 | version "7.8.3" 491 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" 492 | integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== 493 | dependencies: 494 | "@babel/helper-plugin-utils" "^7.8.0" 495 | 496 | "@babel/plugin-syntax-logical-assignment-operators@^7.10.4": 497 | version "7.10.4" 498 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" 499 | integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== 500 | dependencies: 501 | "@babel/helper-plugin-utils" "^7.10.4" 502 | 503 | "@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": 504 | version "7.8.3" 505 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" 506 | integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== 507 | dependencies: 508 | "@babel/helper-plugin-utils" "^7.8.0" 509 | 510 | "@babel/plugin-syntax-numeric-separator@^7.10.4": 511 | version "7.10.4" 512 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" 513 | integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== 514 | dependencies: 515 | "@babel/helper-plugin-utils" "^7.10.4" 516 | 517 | "@babel/plugin-syntax-object-rest-spread@^7.8.3": 518 | version "7.8.3" 519 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" 520 | integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== 521 | dependencies: 522 | "@babel/helper-plugin-utils" "^7.8.0" 523 | 524 | "@babel/plugin-syntax-optional-catch-binding@^7.8.3": 525 | version "7.8.3" 526 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" 527 | integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== 528 | dependencies: 529 | "@babel/helper-plugin-utils" "^7.8.0" 530 | 531 | "@babel/plugin-syntax-optional-chaining@^7.8.3": 532 | version "7.8.3" 533 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" 534 | integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== 535 | dependencies: 536 | "@babel/helper-plugin-utils" "^7.8.0" 537 | 538 | "@babel/plugin-syntax-private-property-in-object@^7.14.5": 539 | version "7.14.5" 540 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz#0dc6671ec0ea22b6e94a1114f857970cd39de1ad" 541 | integrity sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg== 542 | dependencies: 543 | "@babel/helper-plugin-utils" "^7.14.5" 544 | 545 | "@babel/plugin-syntax-top-level-await@^7.14.5": 546 | version "7.14.5" 547 | resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz#c1cfdadc35a646240001f06138247b741c34d94c" 548 | integrity sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw== 549 | dependencies: 550 | "@babel/helper-plugin-utils" "^7.14.5" 551 | 552 | "@babel/plugin-transform-arrow-functions@^7.16.7": 553 | version "7.16.7" 554 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.7.tgz#44125e653d94b98db76369de9c396dc14bef4154" 555 | integrity sha512-9ffkFFMbvzTvv+7dTp/66xvZAWASuPD5Tl9LK3Z9vhOmANo6j94rik+5YMBt4CwHVMWLWpMsriIc2zsa3WW3xQ== 556 | dependencies: 557 | "@babel/helper-plugin-utils" "^7.16.7" 558 | 559 | "@babel/plugin-transform-async-to-generator@^7.16.8": 560 | version "7.16.8" 561 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.16.8.tgz#b83dff4b970cf41f1b819f8b49cc0cfbaa53a808" 562 | integrity sha512-MtmUmTJQHCnyJVrScNzNlofQJ3dLFuobYn3mwOTKHnSCMtbNsqvF71GQmJfFjdrXSsAA7iysFmYWw4bXZ20hOg== 563 | dependencies: 564 | "@babel/helper-module-imports" "^7.16.7" 565 | "@babel/helper-plugin-utils" "^7.16.7" 566 | "@babel/helper-remap-async-to-generator" "^7.16.8" 567 | 568 | "@babel/plugin-transform-block-scoped-functions@^7.16.7": 569 | version "7.16.7" 570 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.16.7.tgz#4d0d57d9632ef6062cdf354bb717102ee042a620" 571 | integrity sha512-JUuzlzmF40Z9cXyytcbZEZKckgrQzChbQJw/5PuEHYeqzCsvebDx0K0jWnIIVcmmDOAVctCgnYs0pMcrYj2zJg== 572 | dependencies: 573 | "@babel/helper-plugin-utils" "^7.16.7" 574 | 575 | "@babel/plugin-transform-block-scoping@^7.16.7": 576 | version "7.16.7" 577 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.16.7.tgz#f50664ab99ddeaee5bc681b8f3a6ea9d72ab4f87" 578 | integrity sha512-ObZev2nxVAYA4bhyusELdo9hb3H+A56bxH3FZMbEImZFiEDYVHXQSJ1hQKFlDnlt8G9bBrCZ5ZpURZUrV4G5qQ== 579 | dependencies: 580 | "@babel/helper-plugin-utils" "^7.16.7" 581 | 582 | "@babel/plugin-transform-classes@^7.16.7": 583 | version "7.16.7" 584 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.16.7.tgz#8f4b9562850cd973de3b498f1218796eb181ce00" 585 | integrity sha512-WY7og38SFAGYRe64BrjKf8OrE6ulEHtr5jEYaZMwox9KebgqPi67Zqz8K53EKk1fFEJgm96r32rkKZ3qA2nCWQ== 586 | dependencies: 587 | "@babel/helper-annotate-as-pure" "^7.16.7" 588 | "@babel/helper-environment-visitor" "^7.16.7" 589 | "@babel/helper-function-name" "^7.16.7" 590 | "@babel/helper-optimise-call-expression" "^7.16.7" 591 | "@babel/helper-plugin-utils" "^7.16.7" 592 | "@babel/helper-replace-supers" "^7.16.7" 593 | "@babel/helper-split-export-declaration" "^7.16.7" 594 | globals "^11.1.0" 595 | 596 | "@babel/plugin-transform-computed-properties@^7.16.7": 597 | version "7.16.7" 598 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.16.7.tgz#66dee12e46f61d2aae7a73710f591eb3df616470" 599 | integrity sha512-gN72G9bcmenVILj//sv1zLNaPyYcOzUho2lIJBMh/iakJ9ygCo/hEF9cpGb61SCMEDxbbyBoVQxrt+bWKu5KGw== 600 | dependencies: 601 | "@babel/helper-plugin-utils" "^7.16.7" 602 | 603 | "@babel/plugin-transform-destructuring@^7.16.7": 604 | version "7.17.7" 605 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.17.7.tgz#49dc2675a7afa9a5e4c6bdee636061136c3408d1" 606 | integrity sha512-XVh0r5yq9sLR4vZ6eVZe8FKfIcSgaTBxVBRSYokRj2qksf6QerYnTxz9/GTuKTH/n/HwLP7t6gtlybHetJ/6hQ== 607 | dependencies: 608 | "@babel/helper-plugin-utils" "^7.16.7" 609 | 610 | "@babel/plugin-transform-dotall-regex@^7.16.7", "@babel/plugin-transform-dotall-regex@^7.4.4": 611 | version "7.16.7" 612 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.16.7.tgz#6b2d67686fab15fb6a7fd4bd895d5982cfc81241" 613 | integrity sha512-Lyttaao2SjZF6Pf4vk1dVKv8YypMpomAbygW+mU5cYP3S5cWTfCJjG8xV6CFdzGFlfWK81IjL9viiTvpb6G7gQ== 614 | dependencies: 615 | "@babel/helper-create-regexp-features-plugin" "^7.16.7" 616 | "@babel/helper-plugin-utils" "^7.16.7" 617 | 618 | "@babel/plugin-transform-duplicate-keys@^7.16.7": 619 | version "7.16.7" 620 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.16.7.tgz#2207e9ca8f82a0d36a5a67b6536e7ef8b08823c9" 621 | integrity sha512-03DvpbRfvWIXyK0/6QiR1KMTWeT6OcQ7tbhjrXyFS02kjuX/mu5Bvnh5SDSWHxyawit2g5aWhKwI86EE7GUnTw== 622 | dependencies: 623 | "@babel/helper-plugin-utils" "^7.16.7" 624 | 625 | "@babel/plugin-transform-exponentiation-operator@^7.16.7": 626 | version "7.16.7" 627 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.16.7.tgz#efa9862ef97e9e9e5f653f6ddc7b665e8536fe9b" 628 | integrity sha512-8UYLSlyLgRixQvlYH3J2ekXFHDFLQutdy7FfFAMm3CPZ6q9wHCwnUyiXpQCe3gVVnQlHc5nsuiEVziteRNTXEA== 629 | dependencies: 630 | "@babel/helper-builder-binary-assignment-operator-visitor" "^7.16.7" 631 | "@babel/helper-plugin-utils" "^7.16.7" 632 | 633 | "@babel/plugin-transform-for-of@^7.16.7": 634 | version "7.16.7" 635 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.7.tgz#649d639d4617dff502a9a158c479b3b556728d8c" 636 | integrity sha512-/QZm9W92Ptpw7sjI9Nx1mbcsWz33+l8kuMIQnDwgQBG5s3fAfQvkRjQ7NqXhtNcKOnPkdICmUHyCaWW06HCsqg== 637 | dependencies: 638 | "@babel/helper-plugin-utils" "^7.16.7" 639 | 640 | "@babel/plugin-transform-function-name@^7.16.7": 641 | version "7.16.7" 642 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.16.7.tgz#5ab34375c64d61d083d7d2f05c38d90b97ec65cf" 643 | integrity sha512-SU/C68YVwTRxqWj5kgsbKINakGag0KTgq9f2iZEXdStoAbOzLHEBRYzImmA6yFo8YZhJVflvXmIHUO7GWHmxxA== 644 | dependencies: 645 | "@babel/helper-compilation-targets" "^7.16.7" 646 | "@babel/helper-function-name" "^7.16.7" 647 | "@babel/helper-plugin-utils" "^7.16.7" 648 | 649 | "@babel/plugin-transform-literals@^7.16.7": 650 | version "7.16.7" 651 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.16.7.tgz#254c9618c5ff749e87cb0c0cef1a0a050c0bdab1" 652 | integrity sha512-6tH8RTpTWI0s2sV6uq3e/C9wPo4PTqqZps4uF0kzQ9/xPLFQtipynvmT1g/dOfEJ+0EQsHhkQ/zyRId8J2b8zQ== 653 | dependencies: 654 | "@babel/helper-plugin-utils" "^7.16.7" 655 | 656 | "@babel/plugin-transform-member-expression-literals@^7.16.7": 657 | version "7.16.7" 658 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.16.7.tgz#6e5dcf906ef8a098e630149d14c867dd28f92384" 659 | integrity sha512-mBruRMbktKQwbxaJof32LT9KLy2f3gH+27a5XSuXo6h7R3vqltl0PgZ80C8ZMKw98Bf8bqt6BEVi3svOh2PzMw== 660 | dependencies: 661 | "@babel/helper-plugin-utils" "^7.16.7" 662 | 663 | "@babel/plugin-transform-modules-amd@^7.16.7": 664 | version "7.16.7" 665 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.16.7.tgz#b28d323016a7daaae8609781d1f8c9da42b13186" 666 | integrity sha512-KaaEtgBL7FKYwjJ/teH63oAmE3lP34N3kshz8mm4VMAw7U3PxjVwwUmxEFksbgsNUaO3wId9R2AVQYSEGRa2+g== 667 | dependencies: 668 | "@babel/helper-module-transforms" "^7.16.7" 669 | "@babel/helper-plugin-utils" "^7.16.7" 670 | babel-plugin-dynamic-import-node "^2.3.3" 671 | 672 | "@babel/plugin-transform-modules-commonjs@^7.16.8": 673 | version "7.17.7" 674 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.17.7.tgz#d86b217c8e45bb5f2dbc11eefc8eab62cf980d19" 675 | integrity sha512-ITPmR2V7MqioMJyrxUo2onHNC3e+MvfFiFIR0RP21d3PtlVb6sfzoxNKiphSZUOM9hEIdzCcZe83ieX3yoqjUA== 676 | dependencies: 677 | "@babel/helper-module-transforms" "^7.17.7" 678 | "@babel/helper-plugin-utils" "^7.16.7" 679 | "@babel/helper-simple-access" "^7.17.7" 680 | babel-plugin-dynamic-import-node "^2.3.3" 681 | 682 | "@babel/plugin-transform-modules-systemjs@^7.16.7": 683 | version "7.17.8" 684 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.17.8.tgz#81fd834024fae14ea78fbe34168b042f38703859" 685 | integrity sha512-39reIkMTUVagzgA5x88zDYXPCMT6lcaRKs1+S9K6NKBPErbgO/w/kP8GlNQTC87b412ZTlmNgr3k2JrWgHH+Bw== 686 | dependencies: 687 | "@babel/helper-hoist-variables" "^7.16.7" 688 | "@babel/helper-module-transforms" "^7.17.7" 689 | "@babel/helper-plugin-utils" "^7.16.7" 690 | "@babel/helper-validator-identifier" "^7.16.7" 691 | babel-plugin-dynamic-import-node "^2.3.3" 692 | 693 | "@babel/plugin-transform-modules-umd@^7.16.7": 694 | version "7.16.7" 695 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.16.7.tgz#23dad479fa585283dbd22215bff12719171e7618" 696 | integrity sha512-EMh7uolsC8O4xhudF2F6wedbSHm1HHZ0C6aJ7K67zcDNidMzVcxWdGr+htW9n21klm+bOn+Rx4CBsAntZd3rEQ== 697 | dependencies: 698 | "@babel/helper-module-transforms" "^7.16.7" 699 | "@babel/helper-plugin-utils" "^7.16.7" 700 | 701 | "@babel/plugin-transform-named-capturing-groups-regex@^7.16.8": 702 | version "7.16.8" 703 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.16.8.tgz#7f860e0e40d844a02c9dcf9d84965e7dfd666252" 704 | integrity sha512-j3Jw+n5PvpmhRR+mrgIh04puSANCk/T/UA3m3P1MjJkhlK906+ApHhDIqBQDdOgL/r1UYpz4GNclTXxyZrYGSw== 705 | dependencies: 706 | "@babel/helper-create-regexp-features-plugin" "^7.16.7" 707 | 708 | "@babel/plugin-transform-new-target@^7.16.7": 709 | version "7.16.7" 710 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.16.7.tgz#9967d89a5c243818e0800fdad89db22c5f514244" 711 | integrity sha512-xiLDzWNMfKoGOpc6t3U+etCE2yRnn3SM09BXqWPIZOBpL2gvVrBWUKnsJx0K/ADi5F5YC5f8APFfWrz25TdlGg== 712 | dependencies: 713 | "@babel/helper-plugin-utils" "^7.16.7" 714 | 715 | "@babel/plugin-transform-object-super@^7.16.7": 716 | version "7.16.7" 717 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.16.7.tgz#ac359cf8d32cf4354d27a46867999490b6c32a94" 718 | integrity sha512-14J1feiQVWaGvRxj2WjyMuXS2jsBkgB3MdSN5HuC2G5nRspa5RK9COcs82Pwy5BuGcjb+fYaUj94mYcOj7rCvw== 719 | dependencies: 720 | "@babel/helper-plugin-utils" "^7.16.7" 721 | "@babel/helper-replace-supers" "^7.16.7" 722 | 723 | "@babel/plugin-transform-parameters@^7.16.7": 724 | version "7.16.7" 725 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.16.7.tgz#a1721f55b99b736511cb7e0152f61f17688f331f" 726 | integrity sha512-AT3MufQ7zZEhU2hwOA11axBnExW0Lszu4RL/tAlUJBuNoRak+wehQW8h6KcXOcgjY42fHtDxswuMhMjFEuv/aw== 727 | dependencies: 728 | "@babel/helper-plugin-utils" "^7.16.7" 729 | 730 | "@babel/plugin-transform-property-literals@^7.16.7": 731 | version "7.16.7" 732 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.16.7.tgz#2dadac85155436f22c696c4827730e0fe1057a55" 733 | integrity sha512-z4FGr9NMGdoIl1RqavCqGG+ZuYjfZ/hkCIeuH6Do7tXmSm0ls11nYVSJqFEUOSJbDab5wC6lRE/w6YjVcr6Hqw== 734 | dependencies: 735 | "@babel/helper-plugin-utils" "^7.16.7" 736 | 737 | "@babel/plugin-transform-regenerator@^7.16.7": 738 | version "7.16.7" 739 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.16.7.tgz#9e7576dc476cb89ccc5096fff7af659243b4adeb" 740 | integrity sha512-mF7jOgGYCkSJagJ6XCujSQg+6xC1M77/03K2oBmVJWoFGNUtnVJO4WHKJk3dnPC8HCcj4xBQP1Egm8DWh3Pb3Q== 741 | dependencies: 742 | regenerator-transform "^0.14.2" 743 | 744 | "@babel/plugin-transform-reserved-words@^7.16.7": 745 | version "7.16.7" 746 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.16.7.tgz#1d798e078f7c5958eec952059c460b220a63f586" 747 | integrity sha512-KQzzDnZ9hWQBjwi5lpY5v9shmm6IVG0U9pB18zvMu2i4H90xpT4gmqwPYsn8rObiadYe2M0gmgsiOIF5A/2rtg== 748 | dependencies: 749 | "@babel/helper-plugin-utils" "^7.16.7" 750 | 751 | "@babel/plugin-transform-shorthand-properties@^7.16.7": 752 | version "7.16.7" 753 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.7.tgz#e8549ae4afcf8382f711794c0c7b6b934c5fbd2a" 754 | integrity sha512-hah2+FEnoRoATdIb05IOXf+4GzXYTq75TVhIn1PewihbpyrNWUt2JbudKQOETWw6QpLe+AIUpJ5MVLYTQbeeUg== 755 | dependencies: 756 | "@babel/helper-plugin-utils" "^7.16.7" 757 | 758 | "@babel/plugin-transform-spread@^7.16.7": 759 | version "7.16.7" 760 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.16.7.tgz#a303e2122f9f12e0105daeedd0f30fb197d8ff44" 761 | integrity sha512-+pjJpgAngb53L0iaA5gU/1MLXJIfXcYepLgXB3esVRf4fqmj8f2cxM3/FKaHsZms08hFQJkFccEWuIpm429TXg== 762 | dependencies: 763 | "@babel/helper-plugin-utils" "^7.16.7" 764 | "@babel/helper-skip-transparent-expression-wrappers" "^7.16.0" 765 | 766 | "@babel/plugin-transform-sticky-regex@^7.16.7": 767 | version "7.16.7" 768 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.16.7.tgz#c84741d4f4a38072b9a1e2e3fd56d359552e8660" 769 | integrity sha512-NJa0Bd/87QV5NZZzTuZG5BPJjLYadeSZ9fO6oOUoL4iQx+9EEuw/eEM92SrsT19Yc2jgB1u1hsjqDtH02c3Drw== 770 | dependencies: 771 | "@babel/helper-plugin-utils" "^7.16.7" 772 | 773 | "@babel/plugin-transform-template-literals@^7.16.7": 774 | version "7.16.7" 775 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.16.7.tgz#f3d1c45d28967c8e80f53666fc9c3e50618217ab" 776 | integrity sha512-VwbkDDUeenlIjmfNeDX/V0aWrQH2QiVyJtwymVQSzItFDTpxfyJh3EVaQiS0rIN/CqbLGr0VcGmuwyTdZtdIsA== 777 | dependencies: 778 | "@babel/helper-plugin-utils" "^7.16.7" 779 | 780 | "@babel/plugin-transform-typeof-symbol@^7.16.7": 781 | version "7.16.7" 782 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.16.7.tgz#9cdbe622582c21368bd482b660ba87d5545d4f7e" 783 | integrity sha512-p2rOixCKRJzpg9JB4gjnG4gjWkWa89ZoYUnl9snJ1cWIcTH/hvxZqfO+WjG6T8DRBpctEol5jw1O5rA8gkCokQ== 784 | dependencies: 785 | "@babel/helper-plugin-utils" "^7.16.7" 786 | 787 | "@babel/plugin-transform-unicode-escapes@^7.16.7": 788 | version "7.16.7" 789 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.7.tgz#da8717de7b3287a2c6d659750c964f302b31ece3" 790 | integrity sha512-TAV5IGahIz3yZ9/Hfv35TV2xEm+kaBDaZQCn2S/hG9/CZ0DktxJv9eKfPc7yYCvOYR4JGx1h8C+jcSOvgaaI/Q== 791 | dependencies: 792 | "@babel/helper-plugin-utils" "^7.16.7" 793 | 794 | "@babel/plugin-transform-unicode-regex@^7.16.7": 795 | version "7.16.7" 796 | resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.16.7.tgz#0f7aa4a501198976e25e82702574c34cfebe9ef2" 797 | integrity sha512-oC5tYYKw56HO75KZVLQ+R/Nl3Hro9kf8iG0hXoaHP7tjAyCpvqBiSNe6vGrZni1Z6MggmUOC6A7VP7AVmw225Q== 798 | dependencies: 799 | "@babel/helper-create-regexp-features-plugin" "^7.16.7" 800 | "@babel/helper-plugin-utils" "^7.16.7" 801 | 802 | "@babel/preset-env@^7.16.11": 803 | version "7.16.11" 804 | resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.16.11.tgz#5dd88fd885fae36f88fd7c8342475c9f0abe2982" 805 | integrity sha512-qcmWG8R7ZW6WBRPZK//y+E3Cli151B20W1Rv7ln27vuPaXU/8TKms6jFdiJtF7UDTxcrb7mZd88tAeK9LjdT8g== 806 | dependencies: 807 | "@babel/compat-data" "^7.16.8" 808 | "@babel/helper-compilation-targets" "^7.16.7" 809 | "@babel/helper-plugin-utils" "^7.16.7" 810 | "@babel/helper-validator-option" "^7.16.7" 811 | "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression" "^7.16.7" 812 | "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" "^7.16.7" 813 | "@babel/plugin-proposal-async-generator-functions" "^7.16.8" 814 | "@babel/plugin-proposal-class-properties" "^7.16.7" 815 | "@babel/plugin-proposal-class-static-block" "^7.16.7" 816 | "@babel/plugin-proposal-dynamic-import" "^7.16.7" 817 | "@babel/plugin-proposal-export-namespace-from" "^7.16.7" 818 | "@babel/plugin-proposal-json-strings" "^7.16.7" 819 | "@babel/plugin-proposal-logical-assignment-operators" "^7.16.7" 820 | "@babel/plugin-proposal-nullish-coalescing-operator" "^7.16.7" 821 | "@babel/plugin-proposal-numeric-separator" "^7.16.7" 822 | "@babel/plugin-proposal-object-rest-spread" "^7.16.7" 823 | "@babel/plugin-proposal-optional-catch-binding" "^7.16.7" 824 | "@babel/plugin-proposal-optional-chaining" "^7.16.7" 825 | "@babel/plugin-proposal-private-methods" "^7.16.11" 826 | "@babel/plugin-proposal-private-property-in-object" "^7.16.7" 827 | "@babel/plugin-proposal-unicode-property-regex" "^7.16.7" 828 | "@babel/plugin-syntax-async-generators" "^7.8.4" 829 | "@babel/plugin-syntax-class-properties" "^7.12.13" 830 | "@babel/plugin-syntax-class-static-block" "^7.14.5" 831 | "@babel/plugin-syntax-dynamic-import" "^7.8.3" 832 | "@babel/plugin-syntax-export-namespace-from" "^7.8.3" 833 | "@babel/plugin-syntax-json-strings" "^7.8.3" 834 | "@babel/plugin-syntax-logical-assignment-operators" "^7.10.4" 835 | "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.3" 836 | "@babel/plugin-syntax-numeric-separator" "^7.10.4" 837 | "@babel/plugin-syntax-object-rest-spread" "^7.8.3" 838 | "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" 839 | "@babel/plugin-syntax-optional-chaining" "^7.8.3" 840 | "@babel/plugin-syntax-private-property-in-object" "^7.14.5" 841 | "@babel/plugin-syntax-top-level-await" "^7.14.5" 842 | "@babel/plugin-transform-arrow-functions" "^7.16.7" 843 | "@babel/plugin-transform-async-to-generator" "^7.16.8" 844 | "@babel/plugin-transform-block-scoped-functions" "^7.16.7" 845 | "@babel/plugin-transform-block-scoping" "^7.16.7" 846 | "@babel/plugin-transform-classes" "^7.16.7" 847 | "@babel/plugin-transform-computed-properties" "^7.16.7" 848 | "@babel/plugin-transform-destructuring" "^7.16.7" 849 | "@babel/plugin-transform-dotall-regex" "^7.16.7" 850 | "@babel/plugin-transform-duplicate-keys" "^7.16.7" 851 | "@babel/plugin-transform-exponentiation-operator" "^7.16.7" 852 | "@babel/plugin-transform-for-of" "^7.16.7" 853 | "@babel/plugin-transform-function-name" "^7.16.7" 854 | "@babel/plugin-transform-literals" "^7.16.7" 855 | "@babel/plugin-transform-member-expression-literals" "^7.16.7" 856 | "@babel/plugin-transform-modules-amd" "^7.16.7" 857 | "@babel/plugin-transform-modules-commonjs" "^7.16.8" 858 | "@babel/plugin-transform-modules-systemjs" "^7.16.7" 859 | "@babel/plugin-transform-modules-umd" "^7.16.7" 860 | "@babel/plugin-transform-named-capturing-groups-regex" "^7.16.8" 861 | "@babel/plugin-transform-new-target" "^7.16.7" 862 | "@babel/plugin-transform-object-super" "^7.16.7" 863 | "@babel/plugin-transform-parameters" "^7.16.7" 864 | "@babel/plugin-transform-property-literals" "^7.16.7" 865 | "@babel/plugin-transform-regenerator" "^7.16.7" 866 | "@babel/plugin-transform-reserved-words" "^7.16.7" 867 | "@babel/plugin-transform-shorthand-properties" "^7.16.7" 868 | "@babel/plugin-transform-spread" "^7.16.7" 869 | "@babel/plugin-transform-sticky-regex" "^7.16.7" 870 | "@babel/plugin-transform-template-literals" "^7.16.7" 871 | "@babel/plugin-transform-typeof-symbol" "^7.16.7" 872 | "@babel/plugin-transform-unicode-escapes" "^7.16.7" 873 | "@babel/plugin-transform-unicode-regex" "^7.16.7" 874 | "@babel/preset-modules" "^0.1.5" 875 | "@babel/types" "^7.16.8" 876 | babel-plugin-polyfill-corejs2 "^0.3.0" 877 | babel-plugin-polyfill-corejs3 "^0.5.0" 878 | babel-plugin-polyfill-regenerator "^0.3.0" 879 | core-js-compat "^3.20.2" 880 | semver "^6.3.0" 881 | 882 | "@babel/preset-modules@^0.1.5": 883 | version "0.1.5" 884 | resolved "https://registry.yarnpkg.com/@babel/preset-modules/-/preset-modules-0.1.5.tgz#ef939d6e7f268827e1841638dc6ff95515e115d9" 885 | integrity sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA== 886 | dependencies: 887 | "@babel/helper-plugin-utils" "^7.0.0" 888 | "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" 889 | "@babel/plugin-transform-dotall-regex" "^7.4.4" 890 | "@babel/types" "^7.4.4" 891 | esutils "^2.0.2" 892 | 893 | "@babel/runtime@^7.8.4": 894 | version "7.17.8" 895 | resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.8.tgz#3e56e4aff81befa55ac3ac6a0967349fd1c5bca2" 896 | integrity sha512-dQpEpK0O9o6lj6oPu0gRDbbnk+4LeHlNcBpspf6Olzt3GIX4P1lWF1gS+pHLDFlaJvbR6q7jCfQ08zA4QJBnmA== 897 | dependencies: 898 | regenerator-runtime "^0.13.4" 899 | 900 | "@babel/template@^7.16.7": 901 | version "7.16.7" 902 | resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.16.7.tgz#8d126c8701fde4d66b264b3eba3d96f07666d155" 903 | integrity sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w== 904 | dependencies: 905 | "@babel/code-frame" "^7.16.7" 906 | "@babel/parser" "^7.16.7" 907 | "@babel/types" "^7.16.7" 908 | 909 | "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8", "@babel/traverse@^7.17.3": 910 | version "7.17.3" 911 | resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.17.3.tgz#0ae0f15b27d9a92ba1f2263358ea7c4e7db47b57" 912 | integrity sha512-5irClVky7TxRWIRtxlh2WPUUOLhcPN06AGgaQSB8AEwuyEBgJVuJ5imdHm5zxk8w0QS5T+tDfnDxAlhWjpb7cw== 913 | dependencies: 914 | "@babel/code-frame" "^7.16.7" 915 | "@babel/generator" "^7.17.3" 916 | "@babel/helper-environment-visitor" "^7.16.7" 917 | "@babel/helper-function-name" "^7.16.7" 918 | "@babel/helper-hoist-variables" "^7.16.7" 919 | "@babel/helper-split-export-declaration" "^7.16.7" 920 | "@babel/parser" "^7.17.3" 921 | "@babel/types" "^7.17.0" 922 | debug "^4.1.0" 923 | globals "^11.1.0" 924 | 925 | "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.17.0", "@babel/types@^7.4.4": 926 | version "7.17.0" 927 | resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.17.0.tgz#a826e368bccb6b3d84acd76acad5c0d87342390b" 928 | integrity sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw== 929 | dependencies: 930 | "@babel/helper-validator-identifier" "^7.16.7" 931 | to-fast-properties "^2.0.0" 932 | 933 | "@jridgewell/resolve-uri@^3.0.3": 934 | version "3.0.5" 935 | resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.0.5.tgz#68eb521368db76d040a6315cdb24bf2483037b9c" 936 | integrity sha512-VPeQ7+wH0itvQxnG+lIzWgkysKIr3L9sslimFW55rHMdGu/qCQ5z5h9zq4gI8uBtqkpHhsF4Z/OwExufUCThew== 937 | 938 | "@jridgewell/sourcemap-codec@^1.4.10": 939 | version "1.4.11" 940 | resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz#771a1d8d744eeb71b6adb35808e1a6c7b9b8c8ec" 941 | integrity sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg== 942 | 943 | "@jridgewell/trace-mapping@^0.3.0", "@jridgewell/trace-mapping@^0.3.4": 944 | version "0.3.4" 945 | resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.4.tgz#f6a0832dffd5b8a6aaa633b7d9f8e8e94c83a0c3" 946 | integrity sha512-vFv9ttIedivx0ux3QSjhgtCVjPZd5l46ZOMDSCwnH1yUO2e964gO8LZGyv2QkqcgR6TnBU1v+1IFqmeoG+0UJQ== 947 | dependencies: 948 | "@jridgewell/resolve-uri" "^3.0.3" 949 | "@jridgewell/sourcemap-codec" "^1.4.10" 950 | 951 | "@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3": 952 | version "2.1.8-no-fsevents.3" 953 | resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b" 954 | integrity sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ== 955 | 956 | ansi-styles@^3.2.1: 957 | version "3.2.1" 958 | resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" 959 | integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== 960 | dependencies: 961 | color-convert "^1.9.0" 962 | 963 | anymatch@~3.1.2: 964 | version "3.1.2" 965 | resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" 966 | integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== 967 | dependencies: 968 | normalize-path "^3.0.0" 969 | picomatch "^2.0.4" 970 | 971 | babel-plugin-dynamic-import-node@^2.3.3: 972 | version "2.3.3" 973 | resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz#84fda19c976ec5c6defef57f9427b3def66e17a3" 974 | integrity sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ== 975 | dependencies: 976 | object.assign "^4.1.0" 977 | 978 | babel-plugin-polyfill-corejs2@^0.3.0: 979 | version "0.3.1" 980 | resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.1.tgz#440f1b70ccfaabc6b676d196239b138f8a2cfba5" 981 | integrity sha512-v7/T6EQcNfVLfcN2X8Lulb7DjprieyLWJK/zOWH5DUYcAgex9sP3h25Q+DLsX9TloXe3y1O8l2q2Jv9q8UVB9w== 982 | dependencies: 983 | "@babel/compat-data" "^7.13.11" 984 | "@babel/helper-define-polyfill-provider" "^0.3.1" 985 | semver "^6.1.1" 986 | 987 | babel-plugin-polyfill-corejs3@^0.5.0: 988 | version "0.5.2" 989 | resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.5.2.tgz#aabe4b2fa04a6e038b688c5e55d44e78cd3a5f72" 990 | integrity sha512-G3uJih0XWiID451fpeFaYGVuxHEjzKTHtc9uGFEjR6hHrvNzeS/PX+LLLcetJcytsB5m4j+K3o/EpXJNb/5IEQ== 991 | dependencies: 992 | "@babel/helper-define-polyfill-provider" "^0.3.1" 993 | core-js-compat "^3.21.0" 994 | 995 | babel-plugin-polyfill-regenerator@^0.3.0: 996 | version "0.3.1" 997 | resolved "https://registry.yarnpkg.com/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.1.tgz#2c0678ea47c75c8cc2fbb1852278d8fb68233990" 998 | integrity sha512-Y2B06tvgHYt1x0yz17jGkGeeMr5FeKUu+ASJ+N6nB5lQ8Dapfg42i0OVrf8PNGJ3zKL4A23snMi1IRwrqqND7A== 999 | dependencies: 1000 | "@babel/helper-define-polyfill-provider" "^0.3.1" 1001 | 1002 | balanced-match@^1.0.0: 1003 | version "1.0.2" 1004 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" 1005 | integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== 1006 | 1007 | binary-extensions@^2.0.0: 1008 | version "2.2.0" 1009 | resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" 1010 | integrity sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA== 1011 | 1012 | brace-expansion@^1.1.7: 1013 | version "1.1.11" 1014 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" 1015 | integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== 1016 | dependencies: 1017 | balanced-match "^1.0.0" 1018 | concat-map "0.0.1" 1019 | 1020 | braces@~3.0.2: 1021 | version "3.0.2" 1022 | resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" 1023 | integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== 1024 | dependencies: 1025 | fill-range "^7.0.1" 1026 | 1027 | browserslist@^4.17.5, browserslist@^4.19.1: 1028 | version "4.20.2" 1029 | resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.20.2.tgz#567b41508757ecd904dab4d1c646c612cd3d4f88" 1030 | integrity sha512-CQOBCqp/9pDvDbx3xfMi+86pr4KXIf2FDkTTdeuYw8OxS9t898LA1Khq57gtufFILXpfgsSx5woNgsBgvGjpsA== 1031 | dependencies: 1032 | caniuse-lite "^1.0.30001317" 1033 | electron-to-chromium "^1.4.84" 1034 | escalade "^3.1.1" 1035 | node-releases "^2.0.2" 1036 | picocolors "^1.0.0" 1037 | 1038 | call-bind@^1.0.0: 1039 | version "1.0.2" 1040 | resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" 1041 | integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== 1042 | dependencies: 1043 | function-bind "^1.1.1" 1044 | get-intrinsic "^1.0.2" 1045 | 1046 | caniuse-lite@^1.0.30001317: 1047 | version "1.0.30001322" 1048 | resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001322.tgz#2e4c09d11e1e8f852767dab287069a8d0c29d623" 1049 | integrity sha512-neRmrmIrCGuMnxGSoh+x7zYtQFFgnSY2jaomjU56sCkTA6JINqQrxutF459JpWcWRajvoyn95sOXq4Pqrnyjew== 1050 | 1051 | chalk@^2.0.0: 1052 | version "2.4.2" 1053 | resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" 1054 | integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== 1055 | dependencies: 1056 | ansi-styles "^3.2.1" 1057 | escape-string-regexp "^1.0.5" 1058 | supports-color "^5.3.0" 1059 | 1060 | charcodes@^0.2.0: 1061 | version "0.2.0" 1062 | resolved "https://registry.yarnpkg.com/charcodes/-/charcodes-0.2.0.tgz#5208d327e6cc05f99eb80ffc814707572d1f14e4" 1063 | integrity sha512-Y4kiDb+AM4Ecy58YkuZrrSRJBDQdQ2L+NyS1vHHFtNtUjgutcZfx3yp1dAONI/oPaPmyGfCLx5CxL+zauIMyKQ== 1064 | 1065 | chokidar@^3.4.0: 1066 | version "3.5.3" 1067 | resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" 1068 | integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== 1069 | dependencies: 1070 | anymatch "~3.1.2" 1071 | braces "~3.0.2" 1072 | glob-parent "~5.1.2" 1073 | is-binary-path "~2.1.0" 1074 | is-glob "~4.0.1" 1075 | normalize-path "~3.0.0" 1076 | readdirp "~3.6.0" 1077 | optionalDependencies: 1078 | fsevents "~2.3.2" 1079 | 1080 | color-convert@^1.9.0: 1081 | version "1.9.3" 1082 | resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" 1083 | integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== 1084 | dependencies: 1085 | color-name "1.1.3" 1086 | 1087 | color-name@1.1.3: 1088 | version "1.1.3" 1089 | resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" 1090 | integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= 1091 | 1092 | commander@^4.0.1: 1093 | version "4.1.1" 1094 | resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" 1095 | integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== 1096 | 1097 | concat-map@0.0.1: 1098 | version "0.0.1" 1099 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" 1100 | integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= 1101 | 1102 | convert-source-map@^1.1.0, convert-source-map@^1.7.0: 1103 | version "1.8.0" 1104 | resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369" 1105 | integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA== 1106 | dependencies: 1107 | safe-buffer "~5.1.1" 1108 | 1109 | core-js-compat@^3.20.2, core-js-compat@^3.21.0: 1110 | version "3.21.1" 1111 | resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.21.1.tgz#cac369f67c8d134ff8f9bd1623e3bc2c42068c82" 1112 | integrity sha512-gbgX5AUvMb8gwxC7FLVWYT7Kkgu/y7+h/h1X43yJkNqhlK2fuYyQimqvKGNZFAY6CKii/GFKJ2cp/1/42TN36g== 1113 | dependencies: 1114 | browserslist "^4.19.1" 1115 | semver "7.0.0" 1116 | 1117 | debug@^4.1.0, debug@^4.1.1: 1118 | version "4.3.4" 1119 | resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" 1120 | integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== 1121 | dependencies: 1122 | ms "2.1.2" 1123 | 1124 | define-properties@^1.1.3: 1125 | version "1.1.3" 1126 | resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" 1127 | integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== 1128 | dependencies: 1129 | object-keys "^1.0.12" 1130 | 1131 | electron-to-chromium@^1.4.84: 1132 | version "1.4.101" 1133 | resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.101.tgz#71f3a10065146d7445ba5d4c06ba2cc063b0817a" 1134 | integrity sha512-XJH+XmJjACx1S7ASl/b//KePcda5ocPnFH2jErztXcIS8LpP0SE6rX8ZxiY5/RaDPnaF1rj0fPaHfppzb0e2Aw== 1135 | 1136 | escalade@^3.1.1: 1137 | version "3.1.1" 1138 | resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" 1139 | integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== 1140 | 1141 | escape-string-regexp@^1.0.5: 1142 | version "1.0.5" 1143 | resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" 1144 | integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= 1145 | 1146 | esutils@^2.0.2: 1147 | version "2.0.3" 1148 | resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" 1149 | integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== 1150 | 1151 | fill-range@^7.0.1: 1152 | version "7.0.1" 1153 | resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" 1154 | integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== 1155 | dependencies: 1156 | to-regex-range "^5.0.1" 1157 | 1158 | fs-readdir-recursive@^1.1.0: 1159 | version "1.1.0" 1160 | resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" 1161 | integrity sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA== 1162 | 1163 | fs.realpath@^1.0.0: 1164 | version "1.0.0" 1165 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" 1166 | integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= 1167 | 1168 | fsevents@~2.3.2: 1169 | version "2.3.2" 1170 | resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" 1171 | integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== 1172 | 1173 | function-bind@^1.1.1: 1174 | version "1.1.1" 1175 | resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" 1176 | integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== 1177 | 1178 | gensync@^1.0.0-beta.2: 1179 | version "1.0.0-beta.2" 1180 | resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" 1181 | integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== 1182 | 1183 | get-intrinsic@^1.0.2: 1184 | version "1.1.1" 1185 | resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" 1186 | integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== 1187 | dependencies: 1188 | function-bind "^1.1.1" 1189 | has "^1.0.3" 1190 | has-symbols "^1.0.1" 1191 | 1192 | glob-parent@~5.1.2: 1193 | version "5.1.2" 1194 | resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" 1195 | integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== 1196 | dependencies: 1197 | is-glob "^4.0.1" 1198 | 1199 | glob@^7.0.0: 1200 | version "7.2.0" 1201 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" 1202 | integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== 1203 | dependencies: 1204 | fs.realpath "^1.0.0" 1205 | inflight "^1.0.4" 1206 | inherits "2" 1207 | minimatch "^3.0.4" 1208 | once "^1.3.0" 1209 | path-is-absolute "^1.0.0" 1210 | 1211 | globals@^11.1.0: 1212 | version "11.12.0" 1213 | resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" 1214 | integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== 1215 | 1216 | has-flag@^3.0.0: 1217 | version "3.0.0" 1218 | resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" 1219 | integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= 1220 | 1221 | has-symbols@^1.0.1: 1222 | version "1.0.3" 1223 | resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" 1224 | integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== 1225 | 1226 | has@^1.0.3: 1227 | version "1.0.3" 1228 | resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" 1229 | integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== 1230 | dependencies: 1231 | function-bind "^1.1.1" 1232 | 1233 | inflight@^1.0.4: 1234 | version "1.0.6" 1235 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" 1236 | integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= 1237 | dependencies: 1238 | once "^1.3.0" 1239 | wrappy "1" 1240 | 1241 | inherits@2: 1242 | version "2.0.4" 1243 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" 1244 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== 1245 | 1246 | is-binary-path@~2.1.0: 1247 | version "2.1.0" 1248 | resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" 1249 | integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== 1250 | dependencies: 1251 | binary-extensions "^2.0.0" 1252 | 1253 | is-core-module@^2.8.1: 1254 | version "2.8.1" 1255 | resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.1.tgz#f59fdfca701d5879d0a6b100a40aa1560ce27211" 1256 | integrity sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA== 1257 | dependencies: 1258 | has "^1.0.3" 1259 | 1260 | is-extglob@^2.1.1: 1261 | version "2.1.1" 1262 | resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" 1263 | integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= 1264 | 1265 | is-glob@^4.0.1, is-glob@~4.0.1: 1266 | version "4.0.3" 1267 | resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" 1268 | integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== 1269 | dependencies: 1270 | is-extglob "^2.1.1" 1271 | 1272 | is-number@^7.0.0: 1273 | version "7.0.0" 1274 | resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" 1275 | integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== 1276 | 1277 | js-tokens@^4.0.0: 1278 | version "4.0.0" 1279 | resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" 1280 | integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== 1281 | 1282 | jsesc@^2.5.1: 1283 | version "2.5.2" 1284 | resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" 1285 | integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== 1286 | 1287 | jsesc@~0.5.0: 1288 | version "0.5.0" 1289 | resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" 1290 | integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= 1291 | 1292 | json5@^2.1.2: 1293 | version "2.2.1" 1294 | resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" 1295 | integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== 1296 | 1297 | lodash.debounce@^4.0.8: 1298 | version "4.0.8" 1299 | resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" 1300 | integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= 1301 | 1302 | make-dir@^2.1.0: 1303 | version "2.1.0" 1304 | resolved "https://registry.yarnpkg.com/make-dir/-/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5" 1305 | integrity sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA== 1306 | dependencies: 1307 | pify "^4.0.1" 1308 | semver "^5.6.0" 1309 | 1310 | minimatch@^3.0.4: 1311 | version "3.1.2" 1312 | resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" 1313 | integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== 1314 | dependencies: 1315 | brace-expansion "^1.1.7" 1316 | 1317 | ms@2.1.2: 1318 | version "2.1.2" 1319 | resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" 1320 | integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== 1321 | 1322 | node-releases@^2.0.2: 1323 | version "2.0.2" 1324 | resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.2.tgz#7139fe71e2f4f11b47d4d2986aaf8c48699e0c01" 1325 | integrity sha512-XxYDdcQ6eKqp/YjI+tb2C5WM2LgjnZrfYg4vgQt49EK268b6gYCHsBLrK2qvJo4FmCtqmKezb0WZFK4fkrZNsg== 1326 | 1327 | normalize-path@^3.0.0, normalize-path@~3.0.0: 1328 | version "3.0.0" 1329 | resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" 1330 | integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== 1331 | 1332 | object-keys@^1.0.12, object-keys@^1.1.1: 1333 | version "1.1.1" 1334 | resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" 1335 | integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== 1336 | 1337 | object.assign@^4.1.0: 1338 | version "4.1.2" 1339 | resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" 1340 | integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== 1341 | dependencies: 1342 | call-bind "^1.0.0" 1343 | define-properties "^1.1.3" 1344 | has-symbols "^1.0.1" 1345 | object-keys "^1.1.1" 1346 | 1347 | once@^1.3.0: 1348 | version "1.4.0" 1349 | resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" 1350 | integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= 1351 | dependencies: 1352 | wrappy "1" 1353 | 1354 | path-is-absolute@^1.0.0: 1355 | version "1.0.1" 1356 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" 1357 | integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= 1358 | 1359 | path-parse@^1.0.7: 1360 | version "1.0.7" 1361 | resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" 1362 | integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== 1363 | 1364 | picocolors@^1.0.0: 1365 | version "1.0.0" 1366 | resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" 1367 | integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== 1368 | 1369 | picomatch@^2.0.4, picomatch@^2.2.1: 1370 | version "2.3.1" 1371 | resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" 1372 | integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== 1373 | 1374 | pify@^4.0.1: 1375 | version "4.0.1" 1376 | resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231" 1377 | integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g== 1378 | 1379 | readdirp@~3.6.0: 1380 | version "3.6.0" 1381 | resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" 1382 | integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== 1383 | dependencies: 1384 | picomatch "^2.2.1" 1385 | 1386 | regenerate-unicode-properties@^10.0.1: 1387 | version "10.0.1" 1388 | resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.0.1.tgz#7f442732aa7934a3740c779bb9b3340dccc1fb56" 1389 | integrity sha512-vn5DU6yg6h8hP/2OkQo3K7uVILvY4iu0oI4t3HFa81UPkhGJwkRwM10JEc3upjdhHjs/k8GJY1sRBhk5sr69Bw== 1390 | dependencies: 1391 | regenerate "^1.4.2" 1392 | 1393 | regenerate@^1.4.2: 1394 | version "1.4.2" 1395 | resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a" 1396 | integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A== 1397 | 1398 | regenerator-runtime@^0.13.4: 1399 | version "0.13.9" 1400 | resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52" 1401 | integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA== 1402 | 1403 | regenerator-transform@^0.14.2: 1404 | version "0.14.5" 1405 | resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.5.tgz#c98da154683671c9c4dcb16ece736517e1b7feb4" 1406 | integrity sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw== 1407 | dependencies: 1408 | "@babel/runtime" "^7.8.4" 1409 | 1410 | regexpu-core@^5.0.1: 1411 | version "5.0.1" 1412 | resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.0.1.tgz#c531122a7840de743dcf9c83e923b5560323ced3" 1413 | integrity sha512-CriEZlrKK9VJw/xQGJpQM5rY88BtuL8DM+AEwvcThHilbxiTAy8vq4iJnd2tqq8wLmjbGZzP7ZcKFjbGkmEFrw== 1414 | dependencies: 1415 | regenerate "^1.4.2" 1416 | regenerate-unicode-properties "^10.0.1" 1417 | regjsgen "^0.6.0" 1418 | regjsparser "^0.8.2" 1419 | unicode-match-property-ecmascript "^2.0.0" 1420 | unicode-match-property-value-ecmascript "^2.0.0" 1421 | 1422 | regjsgen@^0.6.0: 1423 | version "0.6.0" 1424 | resolved "https://registry.yarnpkg.com/regjsgen/-/regjsgen-0.6.0.tgz#83414c5354afd7d6627b16af5f10f41c4e71808d" 1425 | integrity sha512-ozE883Uigtqj3bx7OhL1KNbCzGyW2NQZPl6Hs09WTvCuZD5sTI4JY58bkbQWa/Y9hxIsvJ3M8Nbf7j54IqeZbA== 1426 | 1427 | regjsparser@^0.8.2: 1428 | version "0.8.4" 1429 | resolved "https://registry.yarnpkg.com/regjsparser/-/regjsparser-0.8.4.tgz#8a14285ffcc5de78c5b95d62bbf413b6bc132d5f" 1430 | integrity sha512-J3LABycON/VNEu3abOviqGHuB/LOtOQj8SKmfP9anY5GfAVw/SPjwzSjxGjbZXIxbGfqTHtJw58C2Li/WkStmA== 1431 | dependencies: 1432 | jsesc "~0.5.0" 1433 | 1434 | resolve@^1.14.2: 1435 | version "1.22.0" 1436 | resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.0.tgz#5e0b8c67c15df57a89bdbabe603a002f21731198" 1437 | integrity sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw== 1438 | dependencies: 1439 | is-core-module "^2.8.1" 1440 | path-parse "^1.0.7" 1441 | supports-preserve-symlinks-flag "^1.0.0" 1442 | 1443 | safe-buffer@~5.1.1: 1444 | version "5.1.2" 1445 | resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" 1446 | integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== 1447 | 1448 | semver@7.0.0: 1449 | version "7.0.0" 1450 | resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" 1451 | integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== 1452 | 1453 | semver@^5.6.0: 1454 | version "5.7.1" 1455 | resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" 1456 | integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== 1457 | 1458 | semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: 1459 | version "6.3.0" 1460 | resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" 1461 | integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== 1462 | 1463 | slash@^2.0.0: 1464 | version "2.0.0" 1465 | resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" 1466 | integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== 1467 | 1468 | source-map@^0.5.0: 1469 | version "0.5.7" 1470 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" 1471 | integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= 1472 | 1473 | supports-color@^5.3.0: 1474 | version "5.5.0" 1475 | resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" 1476 | integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== 1477 | dependencies: 1478 | has-flag "^3.0.0" 1479 | 1480 | supports-preserve-symlinks-flag@^1.0.0: 1481 | version "1.0.0" 1482 | resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" 1483 | integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== 1484 | 1485 | to-fast-properties@^2.0.0: 1486 | version "2.0.0" 1487 | resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" 1488 | integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4= 1489 | 1490 | to-regex-range@^5.0.1: 1491 | version "5.0.1" 1492 | resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" 1493 | integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== 1494 | dependencies: 1495 | is-number "^7.0.0" 1496 | 1497 | unicode-canonical-property-names-ecmascript@^2.0.0: 1498 | version "2.0.0" 1499 | resolved "https://registry.yarnpkg.com/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz#301acdc525631670d39f6146e0e77ff6bbdebddc" 1500 | integrity sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ== 1501 | 1502 | unicode-match-property-ecmascript@^2.0.0: 1503 | version "2.0.0" 1504 | resolved "https://registry.yarnpkg.com/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz#54fd16e0ecb167cf04cf1f756bdcc92eba7976c3" 1505 | integrity sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q== 1506 | dependencies: 1507 | unicode-canonical-property-names-ecmascript "^2.0.0" 1508 | unicode-property-aliases-ecmascript "^2.0.0" 1509 | 1510 | unicode-match-property-value-ecmascript@^2.0.0: 1511 | version "2.0.0" 1512 | resolved "https://registry.yarnpkg.com/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz#1a01aa57247c14c568b89775a54938788189a714" 1513 | integrity sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw== 1514 | 1515 | unicode-property-aliases-ecmascript@^2.0.0: 1516 | version "2.0.0" 1517 | resolved "https://registry.yarnpkg.com/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz#0a36cb9a585c4f6abd51ad1deddb285c165297c8" 1518 | integrity sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ== 1519 | 1520 | wrappy@1: 1521 | version "1.0.2" 1522 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" 1523 | integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= 1524 | -------------------------------------------------------------------------------- /additional_content/new_features/02-tuple/babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"], 3 | "plugins": [["@babel/plugin-proposal-record-and-tuple", {"syntaxType": "hash", "importPolyfill": true}]] 4 | } -------------------------------------------------------------------------------- /additional_content/new_features/02-tuple/dist.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | var _recordTuplePolyfill = require("@bloomberg/record-tuple-polyfill"); 4 | 5 | function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 6 | 7 | function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 8 | 9 | function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 10 | 11 | function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 12 | 13 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } 14 | 15 | function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 16 | 17 | function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 18 | 19 | function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 20 | 21 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } 22 | 23 | function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 24 | 25 | var tuple = (0, _recordTuplePolyfill.Tuple)(1, 2, 3, 4); 26 | console.log(tuple); // 访问 tuple 的值 27 | 28 | console.log(tuple[0]); // 不能直接修改 tuple的值 29 | // tuple[0] = 5; 30 | // console.log(tuple); 31 | // 可以使用 with() 32 | 33 | var newTuple = tuple["with"](0, 5); 34 | console.log(newTuple, newTuple === tuple); // 也可以使用 array 方法 35 | 36 | console.log(tuple.map(function (x) { 37 | return x * 2; 38 | })); // 或者使用 spread 运算符,注意 tuple 里只能包含tuple 和record类型 39 | 40 | var newTuple2 = _recordTuplePolyfill.Tuple.apply(void 0, _toConsumableArray(tuple).concat([5])); // const newTuple2 = #[...tuple, 5, [6, 7]]; // 错误 41 | 42 | 43 | console.log(newTuple2); // 也可以解构赋值 44 | 45 | var _tuple = _slicedToArray(tuple, 2), 46 | a = _tuple[0], 47 | b = _tuple[1]; 48 | 49 | console.log(a, b); 50 | -------------------------------------------------------------------------------- /additional_content/new_features/02-tuple/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /additional_content/new_features/02-tuple/index.js: -------------------------------------------------------------------------------- 1 | const tuple = #[1, 2, 3, 4]; 2 | console.log(tuple); 3 | // 访问 tuple 的值 4 | console.log(tuple[0]); 5 | 6 | // 不能直接修改 tuple的值 7 | // tuple[0] = 5; 8 | // console.log(tuple); 9 | 10 | // 可以使用 with() 11 | const newTuple = tuple.with(0, 5); 12 | console.log(newTuple, newTuple === tuple); 13 | 14 | // 也可以使用 array 方法 15 | console.log(tuple.map((x) => x * 2)); 16 | 17 | // 或者使用 spread 运算符,注意 tuple 里只能包含tuple 和record类型 18 | const newTuple2 = #[...tuple, 5]; 19 | // const newTuple2 = #[...tuple, 5, [6, 7]]; // 错误 20 | console.log(newTuple2); 21 | 22 | // 也可以解构赋值 23 | 24 | const [a, b] = tuple; 25 | console.log(a, b); 26 | -------------------------------------------------------------------------------- /additional_content/new_features/02-tuple/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "02-tuple", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "MIT", 6 | "scripts": { 7 | "build": "babel index.js -o dist.js", 8 | "start": "node dist.js" 9 | }, 10 | "devDependencies": { 11 | "@babel/cli": "^7.17.6", 12 | "@babel/core": "^7.17.8", 13 | "@babel/plugin-proposal-record-and-tuple": "^7.18.6", 14 | "@babel/preset-env": "^7.16.11", 15 | "@bloomberg/record-tuple-polyfill": "^0.0.4" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /chapter1/conditions.js: -------------------------------------------------------------------------------- 1 | let score = 75; 2 | // if...else if...else 3 | if (score > 90) { 4 | console.log("优秀"); 5 | } else if (score >= 60) { 6 | console.log("及格"); 7 | } else { 8 | console.log("不及格"); 9 | } 10 | 11 | // while 循环,打印 0 到 9 的数字 12 | let count = 0; 13 | while (count < 10) { 14 | console.log(count++); // 打印出 count,然后自身加 1 15 | } 16 | 17 | // 同样功能的 for 循环 18 | for (let i = 0; i < 10; i++) { 19 | console.log(i); 20 | } 21 | -------------------------------------------------------------------------------- /chapter1/example1/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /chapter1/example1/index.js: -------------------------------------------------------------------------------- 1 | let greeting = "你好!"; 2 | console.log(greeting); 3 | -------------------------------------------------------------------------------- /chapter1/functions.js: -------------------------------------------------------------------------------- 1 | // 普通函数 2 | function sum(a, b) { 3 | return a + b; 4 | } 5 | sum(1, 2); // 3 6 | sum(100, 78); // 178 7 | 8 | // 箭头函数 9 | const sumArrow = (a, b) => a + b; 10 | sumArrow(3, 7); // 10 11 | sumArrow(8, 10); // 18 12 | -------------------------------------------------------------------------------- /chapter1/operators.js: -------------------------------------------------------------------------------- 1 | let a = 3; 2 | let b = 4; 3 | 4 | // 数学运算符 5 | a + b; // 加法,结果为 7 6 | a - b; // 减法,结果为 -1 7 | a * b; // 乘法,结果为 12 8 | a / b; // 除法,结果为 0.75 9 | a % b; // 取模,结果为 3 10 | 11 | // 比较运算符 12 | a > b; // 大于,结果为 false 13 | a <= b; // 小于等于,结果为 true 14 | a === b; // 相等,结果为 false 15 | a !== b; // 不相等,结果为 true 16 | 17 | // 逻辑运算符 18 | true && false; // 逻辑与,结果为 false 19 | true || false; // 逻辑或,结果为 true 20 | !true; // 逻辑非,结果为 false 21 | 22 | // 组合运算符 23 | a *= 3; // 乘等于,结果为 9 24 | a -= b; // 减等于,结果为 5 25 | 26 | // 对象相关 27 | let post = { id: 1, title: "标题" }; 28 | post.id; // 访问属性值,结果为 1 29 | delete post.id; // 删除属性,结果为 true 30 | post; // 删除 id 属性后的对象值, { title: '标题' } 31 | 32 | // 数组相关 33 | let arr = [1, 2, 3]; 34 | arr[0]; // 访问数组中第 1 个元素,结果为 1 35 | arr[1] = 5; // 修改第 2 个元素为 5 36 | arr; // 修改后的数组为 [ 1, 5, 3 ] 37 | -------------------------------------------------------------------------------- /chapter1/variables.js: -------------------------------------------------------------------------------- 1 | let num = 3; // Number 数字类型的变量 2 | let x = 10.23; // 浮点数也是 Number 类型 3 | x = "javascript"; // 把变量 x 改为 String 字符串类型 4 | let bool = true; // Boolean 布尔类型 5 | let empty = null; // Null 类型 6 | let nonExist = undefined; // Undfined 类型 7 | let arr = [1, 2, 3]; // Array 数组类型 8 | let obj = { a: 1, b: 2, c: 3 }; // Object 对象类型 9 | const unchangeable = 8; // Number 类型常量 10 | // unchangeable = 6; // 常量不可重新赋值 11 | -------------------------------------------------------------------------------- /chapter10/generator1.js: -------------------------------------------------------------------------------- 1 | // chapter10/generator1.js 2 | function* generatorFunc() { 3 | yield 1; 4 | yield 2; 5 | 6 | // return 3; 7 | } 8 | 9 | let generator = generatorFunc(); 10 | console.log(generator.next()); 11 | console.log(generator.next()); 12 | console.log(generator.next()); 13 | -------------------------------------------------------------------------------- /chapter10/generator2.js: -------------------------------------------------------------------------------- 1 | // chapter10/generator2.js 2 | function* alphabetGenerator() { 3 | for (let charCode = 97; charCode < 123; charCode++) { 4 | yield String.fromCharCode(charCode); 5 | } 6 | } 7 | 8 | const alphabetIterator = alphabetGenerator(); 9 | console.log(alphabetIterator.next().value); // "a" 10 | console.log(alphabetIterator.next().value); // "b" 11 | console.log(alphabetIterator.next().value); // "c" 12 | 13 | console.log("for of======================"); 14 | for (let letter of alphabetIterator) { 15 | console.log(letter); 16 | } 17 | 18 | alphabetIterator[Symbol.iterator] = alphabetGenerator; 19 | for (let letter of alphabetIterator) { 20 | console.log(letter); // "a" - "z" 21 | } 22 | 23 | for (let letter of alphabetIterator) { 24 | console.log(letter); // "a" - "z" 25 | } 26 | -------------------------------------------------------------------------------- /chapter10/generator3.js: -------------------------------------------------------------------------------- 1 | // chapter10/generator3.js 2 | function* alphabetGenerator() { 3 | for (let charCode = 97; charCode < 123; charCode++) { 4 | yield String.fromCharCode(charCode); 5 | } 6 | } 7 | 8 | let alphabetIterator = { 9 | [Symbol.iterator]: alphabetGenerator, 10 | }; 11 | 12 | console.log([...alphabetIterator]); 13 | 14 | for (let letter of alphabetIterator) { 15 | console.log(letter); 16 | } 17 | -------------------------------------------------------------------------------- /chapter10/generator4.js: -------------------------------------------------------------------------------- 1 | // chapter10/generator4.js 2 | let alphabetIterator = { 3 | [Symbol.iterator]: function* () { 4 | for (let charCode = 97; charCode < 123; charCode++) { 5 | yield String.fromCharCode(charCode); 6 | } 7 | }, 8 | }; 9 | 10 | // 或使用简写形式 11 | let alphabet = { 12 | *[Symbol.iterator]() { 13 | for (let charCode = 97; charCode < 123; charCode++) { 14 | yield String.fromCharCode(charCode); 15 | } 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /chapter10/generator5.js: -------------------------------------------------------------------------------- 1 | // chapter10/generator5.js 2 | function* alphabetGenerator() { 3 | for (let charCode = 97; charCode < 123; charCode++) { 4 | yield String.fromCharCode(charCode); 5 | } 6 | } 7 | 8 | const alphabetIterator = alphabetGenerator(); 9 | console.log(alphabetIterator.next().value); // "a" 10 | console.log(alphabetIterator.next().value); // "b" 11 | console.log(alphabetIterator.return("stop")); // { value: "stop", done: true } 12 | console.log(alphabetIterator.next()); // { value: undefined, done: true } 13 | -------------------------------------------------------------------------------- /chapter10/generator6.js: -------------------------------------------------------------------------------- 1 | // chapter10/generator6.js 2 | function* generatorFunc() { 3 | let param1 = yield 1; // yield 1 返回 "b" 4 | console.log(param1); 5 | let param2 = yield 2; // yield 2 返回 "c" 6 | console.log(param2); 7 | } 8 | let gen = generatorFunc(); 9 | gen.next("a"); // 被忽略 10 | gen.next("b"); // "b" 11 | gen.next("c"); // "c" 12 | -------------------------------------------------------------------------------- /chapter10/generator7.js: -------------------------------------------------------------------------------- 1 | // chapter10/generato7.js 2 | function* alphabetGenerator() { 3 | let step = 1; 4 | for (let charCode = 97; charCode < 123; charCode += step) { 5 | step = (yield String.fromCharCode(charCode)) || 1; 6 | } 7 | } 8 | let gen = alphabetGenerator(); 9 | console.log(gen.next().value); // "a" 10 | console.log(gen.next().value); // "b" 11 | console.log(gen.next(2).value); // "d" 12 | console.log(gen.next().value); // "e" 13 | -------------------------------------------------------------------------------- /chapter10/generator8.js: -------------------------------------------------------------------------------- 1 | // chapter10/generator8.js 2 | function* alphabetGenerator() { 3 | let step = 1; 4 | for (let charCode = 97; charCode < 123; charCode += step) { 5 | try { 6 | step = (yield String.fromCharCode(charCode)) || 1; 7 | } catch (error) { 8 | console.log("捕获了异常:" + error.message); 9 | } 10 | } 11 | } 12 | let gen = alphabetGenerator(); 13 | console.log(gen.next().value); // "a" 14 | console.log(gen.next().value); // "b" 15 | console.log(gen.throw(new Error("出错了"))); 16 | console.log(gen.next()); 17 | -------------------------------------------------------------------------------- /chapter10/generator9.js: -------------------------------------------------------------------------------- 1 | // chapter10/generator9.js 2 | function* gf1() { 3 | yield 1; 4 | yield* gf2(); 5 | yield 3; 6 | } 7 | 8 | function* gf2() { 9 | yield 2; 10 | } 11 | 12 | let g = gf1(); 13 | 14 | console.log(g.next()); 15 | console.log(g.next()); 16 | console.log(g.next()); 17 | console.log(g.next()); 18 | -------------------------------------------------------------------------------- /chapter10/iterable1.js: -------------------------------------------------------------------------------- 1 | // chatper10/iterable1.js 2 | const alphabetIterator = { 3 | charCode: 97, 4 | next() { 5 | if (this.charCode < 123) { 6 | let res = { 7 | value: String.fromCharCode(this.charCode), 8 | done: false, 9 | }; 10 | this.charCode++; 11 | return res; 12 | } else { 13 | return { 14 | done: true, 15 | }; 16 | } 17 | }, 18 | }; 19 | 20 | let alphabetIterator = { 21 | [Symbol.iterator]() { 22 | return alphabetIterator; 23 | }, 24 | }; 25 | 26 | // console.log([...alphabet]); 27 | 28 | // for (let letter of alphabet) { 29 | // console.log(letter); 30 | // } 31 | 32 | const [a, b, c] = alphabetIterator; 33 | console.log(a, b, c); 34 | -------------------------------------------------------------------------------- /chapter10/iterable2.js: -------------------------------------------------------------------------------- 1 | // chatper10/iterable2.js 2 | const alphabetIterator = { 3 | charCode: 97, 4 | next() { 5 | if (this.charCode < 123) { 6 | let res = { 7 | value: String.fromCharCode(this.charCode), 8 | done: false, 9 | }; 10 | this.charCode++; 11 | return res; 12 | } else { 13 | return { 14 | done: true, 15 | }; 16 | } 17 | }, 18 | }; 19 | 20 | let alphabet = { 21 | [Symbol.iterator]() { 22 | return { ...alphabetIterator }; 23 | }, 24 | }; 25 | 26 | console.log([...alphabetIterator]); 27 | 28 | for (let letter of alphabetIterator) { 29 | console.log(letter); 30 | } 31 | 32 | const [a, b, c] = alphabetIterator; 33 | console.log(a, b, c); 34 | -------------------------------------------------------------------------------- /chapter10/iterator1.js: -------------------------------------------------------------------------------- 1 | // chapter10/iterator1.js 2 | const alphabetIterator = { 3 | charCode: 97, 4 | next() { 5 | if (this.charCode < 123) { 6 | let res = { 7 | value: String.fromCharCode(this.charCode), 8 | done: false, 9 | }; 10 | this.charCode++; 11 | return res; 12 | } else { 13 | return { 14 | done: true, 15 | }; 16 | } 17 | }, 18 | }; 19 | 20 | console.log(alphabetIterator.next().value); 21 | console.log(alphabetIterator.next().value); 22 | console.log(alphabetIterator.next().value); 23 | -------------------------------------------------------------------------------- /chapter10/iterator2.js: -------------------------------------------------------------------------------- 1 | // chapter10/iterator2.js 2 | const alphabetIterator = { 3 | charCode: 97, 4 | next() { 5 | if (this.charCode < 123) { 6 | let res = { 7 | value: String.fromCharCode(this.charCode), 8 | done: false, 9 | }; 10 | this.charCode++; 11 | return res; 12 | } else { 13 | return { 14 | done: true, 15 | }; 16 | } 17 | }, 18 | }; 19 | 20 | for ( 21 | let res = alphabetIterator.next(); 22 | !res.done; 23 | res = alphabetIterator.next() 24 | ) { 25 | console.log(res.value); 26 | } 27 | 28 | console.log(alphabetIterator.next()); 29 | console.log(alphabetIterator.next()); 30 | console.log(alphabetIterator.next()); 31 | -------------------------------------------------------------------------------- /chapter10/json1.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 1, 3 | "title": "博客标题", 4 | "isPublished": true, 5 | "comments": [ 6 | { 7 | "id": 1, 8 | "content": "好" 9 | }, 10 | { 11 | "id": 2, 12 | "content": "赞" 13 | } 14 | ], 15 | "author": null 16 | } 17 | -------------------------------------------------------------------------------- /chapter10/json2.js: -------------------------------------------------------------------------------- 1 | // chapter10/json2.js 2 | function replacer(key, value) { 3 | if (typeof value === "number") { 4 | return undefined; 5 | } 6 | return value; 7 | } 8 | const post = { id: 1, title: "博客标题", comments: [{ id: 1, content: "好" }] }; 9 | const json = JSON.stringify(post, replacer); 10 | console.log(json); 11 | -------------------------------------------------------------------------------- /chapter10/json3.js: -------------------------------------------------------------------------------- 1 | // chapter10/json3.js 2 | const obj = { a: 1, b: { c: 2 } }; 3 | console.log(JSON.stringify(obj, null, 2)); 4 | console.log(JSON.stringify(obj, null, "\t")); 5 | -------------------------------------------------------------------------------- /chapter10/json4.js: -------------------------------------------------------------------------------- 1 | // chapter10/json4.js 2 | const json = `{ 3 | "a": 1, 4 | "b": true, 5 | "c": ["d", "e", "f"] 6 | }`; 7 | 8 | console.log(JSON.parse(json)); 9 | -------------------------------------------------------------------------------- /chapter10/map1.js: -------------------------------------------------------------------------------- 1 | // chapter10/map1.js 2 | let map = new Map(); 3 | map.set("a", 1); // key 为字符串 4 | map.set(() => {}, true); // key 为函数 5 | map.set(undefined, "empty"); // key 为 undefined 6 | map.set(null, () => {}); // key 为 null 7 | map.set({ prop: "value" }, null); // key 为 object 8 | map.set("a", 2); // 覆盖已有的 key "a" 9 | console.log(map); // {"a" => 2, ƒ => true, undefined => "empty", null => ƒ, {…} => null} 10 | console.log(map.size); 11 | -------------------------------------------------------------------------------- /chapter10/proxy1.js: -------------------------------------------------------------------------------- 1 | // chapter10/proxy1.js 2 | let obj = { a: 1, b: 2 }; 3 | let proxy = new Proxy(obj, {}); 4 | console.log(proxy); // { a: 1, b: 2 } 5 | proxy.a = 2; // obj 中的 a 也会被修改 6 | console.log(proxy.a); // 2 7 | console.log(obj.a); // 2 8 | delete proxy.b; // obj 中的 b 也会删除 9 | console.log(obj.b); // undefined 10 | -------------------------------------------------------------------------------- /chapter10/proxy2.js: -------------------------------------------------------------------------------- 1 | // chapter10/proxy2.js 2 | let config = { env: "dev" }; 3 | config = new Proxy(config, { 4 | get(target, propName) { 5 | if (propName in target) { 6 | return target[propName]; 7 | } 8 | return "default"; 9 | }, 10 | }); 11 | 12 | // Reflect API 13 | // config = new Proxy(config, { 14 | // get(target, propName) { 15 | // if (Reflect.has(target, propName)) { 16 | // return Reflect.get(target, propName); 17 | // } 18 | // return "default"; 19 | // }, 20 | // }); 21 | 22 | console.log(config.env); // "dev" 23 | console.log(config.version); // "default" 24 | -------------------------------------------------------------------------------- /chapter10/proxy3.js: -------------------------------------------------------------------------------- 1 | // chapter10/proxy3.js 2 | let user = { username: "user", password: 123456 }; 3 | console.log(Object.keys(user)); 4 | user = new Proxy(user, { 5 | ownKeys(target) { 6 | return Reflect.ownKeys(target).filter( 7 | (propName) => propName !== "password" 8 | ); 9 | }, 10 | }); 11 | console.log(Object.keys(user)); 12 | -------------------------------------------------------------------------------- /chapter10/proxy4.js: -------------------------------------------------------------------------------- 1 | // chapter10/proxy4.js 2 | let user = { username: "user", password: 123456 }; 3 | user = new Proxy(user, { 4 | deleteProperty() { 5 | return false; 6 | }, 7 | }); 8 | console.log(delete user.username); // false 9 | console.log(Reflect.deleteProperty(user, "password")); // false 10 | console.log(user); // { username: 'user', password: 123456 } 11 | -------------------------------------------------------------------------------- /chapter10/proxy5.js: -------------------------------------------------------------------------------- 1 | // chapter10/proxy5.js 2 | let findTwo = (x) => x === 2; 3 | findTwo = new Proxy(findTwo, { 4 | apply(target, thisArg, args) { 5 | console.log(`调用了函数 ${target},this 为 ${thisArg},参数为 ${args}`); 6 | return Reflect.apply(target, thisArg, args); 7 | }, 8 | }); 9 | 10 | [1, 2, 3].find(findTwo); 11 | -------------------------------------------------------------------------------- /chapter10/random1.js: -------------------------------------------------------------------------------- 1 | // chapter10/random1.js 2 | function generateRandomInt(min, max) { 3 | min = Math.ceil(min); 4 | max = Math.floor(max); 5 | return Math.floor(Math.random() * (max - min) + min); 6 | } 7 | 8 | const randomInt = () => generateRandomInt(0, 100); 9 | console.log(randomInt()); 10 | console.log(randomInt()); 11 | console.log(randomInt()); 12 | console.log(randomInt()); 13 | -------------------------------------------------------------------------------- /chapter10/symbol_match1.js: -------------------------------------------------------------------------------- 1 | // chapter10/symbol_match1.js 2 | const mp3FilePattern = { 3 | [Symbol.match](str) { 4 | return str.endsWith(".mp3"); 5 | }, 6 | }; 7 | 8 | let res = "song.mp3".match(mp3FilePattern); 9 | let res2 = "text.txt".match(mp3FilePattern); 10 | console.log(res, res2); // true false 11 | -------------------------------------------------------------------------------- /chapter10/symbol_species1.js: -------------------------------------------------------------------------------- 1 | // chapter10/symbol_species1.js 2 | class CustomArray extends Array { 3 | static get [Symbol.species]() { 4 | return Array; 5 | } 6 | } 7 | let ca = new CustomArray(1, 2, 3); 8 | let squared = ca.map((v) => v ** 2); 9 | 10 | console.log(squared instanceof CustomArray); // true 11 | console.log(squared instanceof Array); // true 12 | -------------------------------------------------------------------------------- /chapter10/symbol_toPrimitive1.js: -------------------------------------------------------------------------------- 1 | // chapter10/symbol_toPrimitive1.js 2 | let obj = { 3 | [Symbol.toPrimitive](t) { 4 | if (t === "number") return 10; 5 | if (t === "string") return "10"; 6 | return ""; 7 | }, 8 | }; 9 | "hello " + obj; // "hello ", default 10 | obj - 2; // 8, number 11 | `${obj}`; // "10", string 12 | -------------------------------------------------------------------------------- /chapter10/typed_array1.js: -------------------------------------------------------------------------------- 1 | // chapter10/typed_array1.js 2 | let int16arr = new Int16Array(2); 3 | int16arr[0] = 236; 4 | int16arr[1] = 13; 5 | int16arr; // [236, 13] 6 | let int8arr = new Int8Array(int16arr); 7 | int8arr; // [-20, 13] 8 | -------------------------------------------------------------------------------- /chapter10/typed_array2.js: -------------------------------------------------------------------------------- 1 | // chapter10/typed_array2.js 2 | let buffer = new ArrayBuffer(4); 3 | let dataView = new DataView(buffer); 4 | 5 | console.log(dataView.setInt32(0, 0x1f320070)); 6 | console.log(dataView.getInt16(0)); // 7986 7 | console.log(dataView.getInt16(2)); // 112 8 | console.log(dataView.getInt16(0, true)); // 12831 9 | console.log(dataView.getInt16(2, true)); // 28672 10 | 11 | console.log(dataView.getInt16(1)); // 12800 12 | -------------------------------------------------------------------------------- /chapter11/exception1.js: -------------------------------------------------------------------------------- 1 | // chapter11/exception1.js 2 | try { 3 | let obj = undefined; 4 | obj.method(); 5 | } catch (e) { 6 | console.error(e.name); 7 | console.error("不能访问 undefined 中的方法"); 8 | } 9 | console.log("此行能正常执行"); 10 | -------------------------------------------------------------------------------- /chapter11/exception2.js: -------------------------------------------------------------------------------- 1 | // chapter11/exception2.js 2 | function setName(name) { 3 | if (!name) throw "name 不能为空"; 4 | console.log("这行不会执行"); 5 | } 6 | // 未捕获异常 7 | // setName(); 8 | 9 | // 捕获异常 10 | try { 11 | setName(); 12 | } catch (e) { 13 | console.error(e); 14 | } 15 | -------------------------------------------------------------------------------- /chapter11/exception3.js: -------------------------------------------------------------------------------- 1 | // chapter11/exception3.js 2 | function division(a, b) { 3 | // if (b === 0) throw new Error("除数不能为 0"); 4 | if (b === 0) throw new RangeError("除数不能为 0"); 5 | return a / b; 6 | } 7 | division(5, 0); 8 | -------------------------------------------------------------------------------- /chapter11/exception4.js: -------------------------------------------------------------------------------- 1 | // chapter11/exception4.js 2 | class ValidationError extends Error { 3 | constructor(message, input) { 4 | super(message + ",用户输入:" + input); 5 | this.name = ValidationError.name; 6 | this.input = input; 7 | } 8 | } 9 | 10 | function validatePassword(pwd) { 11 | if (!pwd || pwd.length < 8) 12 | throw new ValidationError("密码不能小于 8 位", pwd); 13 | return true; 14 | } 15 | 16 | try { 17 | validatePassword("123456"); 18 | } catch (e) { 19 | console.log(e instanceof ValidationError); 20 | console.log(e.name); 21 | console.log(e.message); 22 | console.log(e.input); 23 | } 24 | -------------------------------------------------------------------------------- /chapter11/exception5.js: -------------------------------------------------------------------------------- 1 | // chapter11/exception5.js 2 | try { 3 | console.log("获取数据库连接对象"); 4 | throw "出现错误"; 5 | } catch { 6 | console.log("不能获取连接"); 7 | } finally { 8 | console.log("关闭数据库对象"); 9 | } 10 | -------------------------------------------------------------------------------- /chapter11/exception6.js: -------------------------------------------------------------------------------- 1 | // chapter11/exception6.js 2 | function getConnection() { 3 | let conn = null; 4 | try { 5 | console.log("获取数据库连接对象"); 6 | conn = "连接对象"; 7 | return conn; 8 | } catch { 9 | console.log("不能获取连接"); 10 | } finally { 11 | console.log("关闭数据库对象"); 12 | conn = "连接已关闭"; 13 | // return conn; 14 | } 15 | } 16 | 17 | let conn = getConnection(); 18 | console.log(conn); 19 | -------------------------------------------------------------------------------- /chapter11/exception7.js: -------------------------------------------------------------------------------- 1 | // chapter11/exception7.js 2 | function division(a, b) { 3 | if (typeof a !== "number") throw new TypeError("a 必须为数字"); 4 | if (typeof b !== "number") throw new TypeError("b 必须为数字"); 5 | if (b === 0) throw new RangeError("除数不能为 0"); 6 | return a / b; 7 | } 8 | 9 | try { 10 | division(1, "a"); 11 | // division(1, 0); 12 | } catch (e) { 13 | if (e instanceof TypeError) { 14 | console.log("类型不正确"); 15 | } else if (e instanceof RangeError) { 16 | console.log("取值不正确"); 17 | } else { 18 | console.log(e); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /chapter12/async1.js: -------------------------------------------------------------------------------- 1 | // chapter12/async1.js 2 | const promise = new Promise((resolve) => setTimeout(resolve, 3 * 1000, "done")); 3 | async function logResult() { 4 | const result = await promise; 5 | console.log(result); 6 | } 7 | logResult(); 8 | -------------------------------------------------------------------------------- /chapter12/async2.js: -------------------------------------------------------------------------------- 1 | // chapter12/async2.js 2 | // 需要在浏览器中执行 3 | async function getPosts() { 4 | const res = await fetch("https://jsonplaceholder.typicode.com/posts"); 5 | const posts = await res.json(); 6 | return posts; 7 | } 8 | getPosts().then((posts) => console.log(posts)); 9 | -------------------------------------------------------------------------------- /chapter12/async3.js: -------------------------------------------------------------------------------- 1 | // chapter12/async3.js 2 | // 需要在浏览器中执行 3 | async function getPosts() { 4 | try { 5 | const res = await fetch("https://jsonplaceholder.typicode.com/posts"); 6 | if (res.status >= 400) { 7 | throw res.status; 8 | } 9 | const posts = await res.json(); 10 | return posts; 11 | } catch (error) { 12 | if (error === 404) { 13 | return []; 14 | } else { 15 | console.log(error); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /chapter12/async_generator1.js: -------------------------------------------------------------------------------- 1 | // chapter12/async_generator1.js 2 | async function* asyncAlphabetGen() { 3 | for (let charCode = 97; charCode < 123; charCode++) { 4 | await new Promise((resolve) => setTimeout(resolve, 1000)); 5 | yield String.fromCharCode(charCode); 6 | } 7 | } 8 | 9 | (async function () { 10 | for await (let letter of asyncAlphabetGen()) { 11 | console.log(letter); 12 | } 13 | })(); 14 | -------------------------------------------------------------------------------- /chapter12/async_generator2.js: -------------------------------------------------------------------------------- 1 | // chapter12/async_generator2.js 2 | async function* asyncAlphabetGen() { 3 | for (let charCode = 97; charCode < 123; charCode++) { 4 | await new Promise((resolve) => setTimeout(resolve, 1000)); 5 | yield String.fromCharCode(charCode); 6 | } 7 | } 8 | 9 | const alphabet = { 10 | [Symbol.asyncIterator]() { 11 | return asyncAlphabetGen(); 12 | }, 13 | }; 14 | 15 | (async function () { 16 | for await (let letter of alphabet) { 17 | console.log(letter); 18 | } 19 | })(); 20 | -------------------------------------------------------------------------------- /chapter12/async_generator3.js: -------------------------------------------------------------------------------- 1 | // chapter12/async_generator3.js 2 | const alphabet = { 3 | async *[Symbol.asyncIterator]() { 4 | for (let charCode = 97; charCode < 123; charCode++) { 5 | await new Promise((resolve) => setTimeout(resolve, 1000)); 6 | yield String.fromCharCode(charCode); 7 | } 8 | }, 9 | }; 10 | 11 | (async function () { 12 | for await (let letter of alphabet) { 13 | console.log(letter); 14 | } 15 | })(); 16 | -------------------------------------------------------------------------------- /chapter12/async_generator4.js: -------------------------------------------------------------------------------- 1 | // chapter12/async_generator4.js 2 | // 需要在浏览器中执行 3 | async function* fetchPosts() { 4 | let page = 1; 5 | while (true) { 6 | try { 7 | const res = await fetch( 8 | `https://jsonplaceholder.typicode.com/posts?_page=${page}&_limit=20` 9 | ); 10 | const posts = await res.json(); 11 | if (posts && posts.length > 0) { 12 | yield* posts; 13 | page++; 14 | } else { 15 | break; 16 | } 17 | } catch (error) { 18 | break; 19 | } 20 | } 21 | } 22 | 23 | (async function () { 24 | let posts = []; 25 | for await (let post of fetchPosts()) { 26 | if (posts.length < 50) { 27 | posts.push(post); 28 | } 29 | } 30 | console.log(posts); 31 | })(); 32 | -------------------------------------------------------------------------------- /chapter12/async_iterator1.js: -------------------------------------------------------------------------------- 1 | // chapter12/async_iterator1.js 2 | const alphabet = { 3 | [Symbol.asyncIterator]() { 4 | return { 5 | charCode: 97, 6 | async next() { 7 | await new Promise((resolve) => setTimeout(resolve, 1000)); 8 | if (this.charCode < 123) { 9 | let res = { 10 | value: String.fromCharCode(this.charCode++), 11 | done: false, 12 | }; 13 | return res; 14 | } else { 15 | return { 16 | done: true, 17 | }; 18 | } 19 | }, 20 | }; 21 | }, 22 | }; 23 | 24 | (async function () { 25 | for await (let letter of alphabet) { 26 | console.log(letter); 27 | } 28 | })(); 29 | -------------------------------------------------------------------------------- /chapter12/event_loop1.js: -------------------------------------------------------------------------------- 1 | // chapter12/event_loop1.js 2 | setTimeout(() => { 3 | console.log(1); 4 | }, 0); 5 | new Promise((resolve) => { 6 | resolve(2); 7 | }).then((value) => console.log(value)); 8 | -------------------------------------------------------------------------------- /chapter12/event_loop2.js: -------------------------------------------------------------------------------- 1 | // chapter12/event_loop2.js 2 | setTimeout(() => { 3 | console.log(1); 4 | }, 0); 5 | new Promise((resolve) => { 6 | resolve(2); 7 | }) 8 | .then((value) => { 9 | console.log(value); 10 | return 3; 11 | }) 12 | .then((value) => console.log(value)); 13 | -------------------------------------------------------------------------------- /chapter12/event_loop3.js: -------------------------------------------------------------------------------- 1 | // chapter12/event_loop3.js 2 | console.log(1); 3 | setTimeout(() => { 4 | console.log(2); 5 | }, 0); 6 | 7 | let p = new Promise((resolve) => { 8 | setTimeout(resolve, 100, 3); 9 | }); 10 | 11 | async function asyncFunc() { 12 | console.log(4); 13 | const value = await asyncFunc2(); 14 | console.log(value); 15 | console.log(5); 16 | } 17 | 18 | asyncFunc(); 19 | 20 | async function asyncFunc2() { 21 | const value = await p; 22 | console.log(value); 23 | return 6; 24 | } 25 | 26 | console.log(7); 27 | -------------------------------------------------------------------------------- /chapter12/event_loop4.js: -------------------------------------------------------------------------------- 1 | // chapter12/event_loop4.js 2 | console.log(1); 3 | setTimeout(() => { 4 | console.log(2); 5 | }, 1000); 6 | 7 | new Promise((resolve) => { 8 | setTimeout(resolve, 1000, 3); 9 | }) 10 | .then((value) => { 11 | console.log(value); 12 | }) 13 | .then(() => { 14 | console.log(4); 15 | }); 16 | 17 | async function asyncFunc1() { 18 | try { 19 | const v1 = await new Promise((resolve) => resolve(7)); 20 | console.log(v1); 21 | await asyncFunc2(); 22 | } catch (error) { 23 | console.log(error); 24 | } finally { 25 | console.log(8); 26 | } 27 | console.log(9); 28 | } 29 | 30 | asyncFunc1(); 31 | 32 | async function asyncFunc2() { 33 | console.log(5); 34 | 35 | throw 6; 36 | } 37 | 38 | console.log(10); 39 | -------------------------------------------------------------------------------- /chapter12/promise1.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise1.js 2 | const p = new Promise((resolve) => { 3 | setTimeout(() => { 4 | resolve(5); 5 | }, 1000); 6 | }); 7 | p.then((value) => console.log(value)); 8 | -------------------------------------------------------------------------------- /chapter12/promise2.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise2.js 2 | const p = new Promise((resolve) => { 3 | console.log("in promise..."); 4 | for (let i = 0; i < 10000000000; i++) {} 5 | resolve(); 6 | }); 7 | console.log("start"); 8 | -------------------------------------------------------------------------------- /chapter12/promise3.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise3.js 2 | new Promise((resolve) => { 3 | setTimeout(() => { 4 | resolve(5); 5 | }, 1000); 6 | }) 7 | .then((value) => { 8 | // 第 1 个 then 9 | console.log(value); 10 | return 10; 11 | }) 12 | .then((value) => { 13 | // 第 2 个 then 14 | console.log(value); 15 | return new Promise((resolve) => { 16 | setTimeout(() => { 17 | resolve(15); 18 | }, 3 * 1000); 19 | }); 20 | }) 21 | .then((value) => { 22 | // 第 3 个 then 23 | console.log(value); 24 | }) 25 | .then(() => { 26 | // 第 4 个 then 27 | console.log("done"); 28 | }); 29 | -------------------------------------------------------------------------------- /chapter12/promise4.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise4.js 2 | // 需要在浏览器中执行 3 | fetch("https://jsonplaceholder.typicode.com/posts") 4 | .then((res) => res.json()) 5 | .then((posts) => { 6 | console.log(posts); 7 | }); 8 | -------------------------------------------------------------------------------- /chapter12/promise5.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise5.js 2 | new Promise((resolve, reject) => { 3 | setTimeout(() => { 4 | try { 5 | new Array(NaN); 6 | resolve(5); 7 | } catch { 8 | reject("指定数组长度时必须是有效数字"); 9 | } 10 | }, 1000); 11 | }) 12 | .then( 13 | (value) => { 14 | console.log(value); 15 | } 16 | // (error) => { 17 | // console.log(error); 18 | // } 19 | ) 20 | .catch((error) => { 21 | console.log(error); 22 | }); 23 | -------------------------------------------------------------------------------- /chapter12/promise5_1.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise5_1.js 2 | new Promise((resolve, reject) => { 3 | setTimeout(() => { 4 | try { 5 | new Array(NaN); 6 | resolve(5); 7 | } catch { 8 | reject("指定数组长度时必须是有效数字"); 9 | } 10 | }, 1000); 11 | }) 12 | .catch((error) => { 13 | console.log(error); 14 | return 10; 15 | }) 16 | .then((value) => { 17 | console.log(value); 18 | }); 19 | -------------------------------------------------------------------------------- /chapter12/promise6.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise6.js 2 | fetch("https://jsonplaceholder.typicode.com/posts") 3 | .then((res) => { 4 | const status = res.status; 5 | if (status >= 400) { 6 | throw status; 7 | } 8 | return res.json(); 9 | }) 10 | .catch((error) => { 11 | if (error === 404) { 12 | console.log("未请求到数据"); 13 | return []; 14 | } 15 | throw error; 16 | }) 17 | .then((posts) => { 18 | console.log(posts); 19 | }) 20 | .catch((error) => { 21 | console.log(error); 22 | }); 23 | -------------------------------------------------------------------------------- /chapter12/promise_all1.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise_all1.js 2 | const promise1 = new Promise((resolve) => setTimeout(resolve, 300, 1)); 3 | const promise2 = new Promise((resolve) => setTimeout(resolve, 100, 2)); 4 | const promise3 = 3; 5 | Promise.all([promise1, promise2, promise3]).then((values) => { 6 | console.log(values); 7 | }); 8 | -------------------------------------------------------------------------------- /chapter12/promise_all2.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise_all2.js 2 | const promise1 = new Promise((resolve, reject) => 3 | setTimeout(reject, 300, "失败") 4 | ); 5 | const promise2 = new Promise((resolve) => setTimeout(resolve, 100, 2)); 6 | const promise3 = 3; 7 | Promise.all([promise1, promise2, promise3]) 8 | .then((values) => { 9 | console.log(values); 10 | }) 11 | .catch((error) => { 12 | console.log(error); 13 | }); 14 | -------------------------------------------------------------------------------- /chapter12/promise_allSettled1.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise_allSettled1.js 2 | const promise1 = new Promise((resolve, reject) => 3 | setTimeout(reject, 300, "失败") 4 | ); 5 | const promise2 = new Promise((resolve) => setTimeout(resolve, 100, 2)); 6 | const promise3 = 3; 7 | Promise.allSettled([promise1, promise2, promise3]).then((values) => { 8 | console.log(values); 9 | }); 10 | -------------------------------------------------------------------------------- /chapter12/promise_any1.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise_any1.js 2 | const promise1 = new Promise((resolve) => setTimeout(resolve, 300, 1)); 3 | const promise2 = new Promise((resolve) => setTimeout(resolve, 100, 2)); 4 | const promise3 = 3; 5 | Promise.any([promise1, promise2, promise3]).then((value) => { 6 | console.log(value); 7 | }); 8 | -------------------------------------------------------------------------------- /chapter12/promise_sequential1.js: -------------------------------------------------------------------------------- 1 | // chapter12/promise_sequential1.js 2 | const promise1 = new Promise((resolve) => setTimeout(resolve, 300, 3)); 3 | const promise2 = new Promise((resolve) => setTimeout(resolve, 200, 2)); 4 | const promise3 = new Promise((resolve) => setTimeout(resolve, 400, 1)); 5 | 6 | promise1 7 | .then(() => promise2) 8 | .then(() => promise3) 9 | .then((value) => { 10 | console.log(value); 11 | }); 12 | -------------------------------------------------------------------------------- /chapter13/example2/add.js: -------------------------------------------------------------------------------- 1 | export default function add(a, b) { 2 | return a + b; 3 | } 4 | -------------------------------------------------------------------------------- /chapter13/example2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /chapter13/example2/index.js: -------------------------------------------------------------------------------- 1 | import add from "./add.js"; 2 | import print from "./print.js"; 3 | 4 | const res = add(1, 2); 5 | print(res); 6 | -------------------------------------------------------------------------------- /chapter13/example2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "module2", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC" 13 | } 14 | -------------------------------------------------------------------------------- /chapter13/example2/print.js: -------------------------------------------------------------------------------- 1 | export default function print(...value) { 2 | console.log(...value); 3 | } 4 | -------------------------------------------------------------------------------- /chapter13/example3/button.js: -------------------------------------------------------------------------------- 1 | // chapter13/example3/button.js 2 | export function ButtonCircle() { 3 | console.log("圆形按钮"); 4 | } 5 | 6 | export function ButtonRect() { 7 | console.log("矩形按钮"); 8 | } 9 | 10 | export default function Button() { 11 | console.log("普通按钮"); 12 | } 13 | -------------------------------------------------------------------------------- /chapter13/example3/form/index.js: -------------------------------------------------------------------------------- 1 | // chapter13/example3/form/index.js 2 | export { Select } from "./select.js"; 3 | export { Radio } from "./radio.js"; 4 | export { default as InputText, InputPwd, InputCheckbox } from "./input.js"; 5 | -------------------------------------------------------------------------------- /chapter13/example3/form/input.js: -------------------------------------------------------------------------------- 1 | // chapter13/example3/form/input.js 2 | export function InputPwd() { 3 | return "密码输入框"; 4 | } 5 | 6 | export function InputCheckbox() { 7 | return "复选框"; 8 | } 9 | 10 | export default function InputText() { 11 | return "文本输出框"; 12 | } 13 | -------------------------------------------------------------------------------- /chapter13/example3/form/radio.js: -------------------------------------------------------------------------------- 1 | // chapter13/example3/form/radio.js 2 | export function Radio() { 3 | return "单选按钮"; 4 | } 5 | -------------------------------------------------------------------------------- /chapter13/example3/form/select.js: -------------------------------------------------------------------------------- 1 | // chapter13/example3/form/select.js 2 | export function Select() { 3 | return "下拉选项"; 4 | } 5 | -------------------------------------------------------------------------------- /chapter13/example3/index.js: -------------------------------------------------------------------------------- 1 | // chapter13/example3/index.js 2 | 3 | // 命名导入 4 | import { a, add, obj } from "./module1.js"; 5 | 6 | // 默认导入 7 | import sum from "./sum.js"; 8 | // 或 9 | import plus from "./sum.js"; 10 | 11 | // 命名+默认导入 12 | import Button, { ButtonCircle, ButtonRect } from "./button.js"; 13 | 14 | // 别名导入,add 与第 2 行导入的同名 15 | import { add as addForThree } from "./module2.js"; 16 | 17 | // 只执行代码 18 | import "./module3.js"; 19 | 20 | // 导入 Form 表单模块 21 | import { 22 | InputText, 23 | InputPwd, 24 | InputCheckbox, 25 | Select, 26 | Radio, 27 | } from "./form/index.js"; 28 | 29 | // 动态导入 30 | function handleClickEvent() { 31 | import("./button.js").then((button) => { 32 | button.default; 33 | button.ButtonCircle; 34 | button.ButtonRect; 35 | }); 36 | } 37 | 38 | // async function handleClickEvent() { 39 | // let button = await import("./button.js"); 40 | // button.default; 41 | // button.ButtonCircle; 42 | // button.ButtonRect; 43 | // } 44 | -------------------------------------------------------------------------------- /chapter13/example3/module1.js: -------------------------------------------------------------------------------- 1 | // chapter13/exmple3/module1.js 2 | export const a = 1; 3 | export function add(a, b) { 4 | return a + b; 5 | } 6 | export const obj = { prop: "value" }; 7 | -------------------------------------------------------------------------------- /chapter13/example3/module2.js: -------------------------------------------------------------------------------- 1 | // chapter13/example3/module2.js 2 | export function add(a, b, c) { 3 | return a + b + c; 4 | } 5 | -------------------------------------------------------------------------------- /chapter13/example3/module3.js: -------------------------------------------------------------------------------- 1 | // chapter13/example3/module3.js 2 | console.log("hello world"); 3 | -------------------------------------------------------------------------------- /chapter13/example3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example3", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /chapter13/example3/sum.js: -------------------------------------------------------------------------------- 1 | // chapter13/example3/sum.js 2 | 3 | function sum(a, b) { 4 | return a + b; 5 | } 6 | 7 | export default sum; 8 | 9 | // export default function (a, b) { 10 | // return a + b; 11 | // } 12 | -------------------------------------------------------------------------------- /chapter13/example4/index.js: -------------------------------------------------------------------------------- 1 | // chapter13/example4/index.js 2 | // const posts = require("./posts"); 3 | // console.log(posts.getAllTitle()); 4 | 5 | // 导入某个项目 6 | // const getAllContent = require("./posts").getAllContent; 7 | 8 | // 使用解构赋值 9 | const { getAllTitle } = require("./posts"); 10 | -------------------------------------------------------------------------------- /chapter13/example4/posts.js: -------------------------------------------------------------------------------- 1 | // chapter13/example4/posts.js 2 | const posts = [ 3 | { id: 1, title: "标题 1", content: "内容 1" }, 4 | { id: 2, title: "标题 2", content: "内容 2" }, 5 | { id: 3, title: "标题 3", content: "内容 3" }, 6 | ]; 7 | 8 | // const getAllTitle = () => { 9 | // return posts.map((post) => post.title); 10 | // }; 11 | 12 | // const getAllContent = () => { 13 | // return posts.map((post) => post.content); 14 | // }; 15 | 16 | // module.exports = { getAllTitle, getAllContent }; 17 | 18 | // exports 简写形式 19 | // exports.getAllTitle = getAllTitle; 20 | // exports.getAllContent = getAllContent; 21 | 22 | // exports 直接导出 23 | exports.getAllTitle = () => { 24 | return posts.map((post) => post.title); 25 | }; 26 | exports.getAllContent = () => { 27 | return posts.map((post) => post.content); 28 | }; 29 | -------------------------------------------------------------------------------- /chapter13/module1.js: -------------------------------------------------------------------------------- 1 | // chapter13/module1.js 2 | const slider = (function () { 3 | let _data = []; 4 | let current = 0; 5 | 6 | function getCurrentInRange(current) { 7 | return ((current % _data.length) + _data.length) % _data.length; 8 | } 9 | 10 | return { 11 | init(data) { 12 | _data = data; 13 | }, 14 | next() { 15 | current = getCurrentInRange(current + 1); 16 | }, 17 | prev() { 18 | current = getCurrentInRange(current - 1); 19 | }, 20 | getCurrent() { 21 | return current; 22 | }, 23 | }; 24 | })(); 25 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/Address.js: -------------------------------------------------------------------------------- 1 | class Address { 2 | constructor({ 3 | name = "", 4 | province = "", 5 | city = "", 6 | address = "", 7 | mobilePhone = "", 8 | } = {}) { 9 | this.name = name; 10 | this.province = province; 11 | this.city = city; 12 | this.address = address; 13 | this.mobilePhone = mobilePhone; 14 | } 15 | 16 | get fullAddress() { 17 | return `${this.province}${this.city}${this.address}`; 18 | } 19 | } 20 | 21 | export default Address; 22 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/Cart.js: -------------------------------------------------------------------------------- 1 | import Order from "./Order.js"; 2 | import { generateId } from "./utils.js"; 3 | 4 | class Cart { 5 | #items = new Map(); 6 | 7 | addToCart(clothes) { 8 | if (this.#items.has(clothes.id)) { 9 | this.#items.get(clothes.id).count++; 10 | } else { 11 | this.#items.set(clothes.id, { item: clothes, count: 1 }); 12 | } 13 | } 14 | 15 | displayCartContent() { 16 | console.table( 17 | [...this.#items.values()].map((item) => ({ 18 | ...item.item, 19 | count: item.count, 20 | })), 21 | ["name", "price", "color", "size", "count"] 22 | ); 23 | } 24 | 25 | getTotalPrice() { 26 | return [...this.#items.values()].reduce( 27 | (acc, curr) => acc + curr.item.price * curr.count, 28 | 0 29 | ); 30 | } 31 | 32 | checkout(store, address, user) { 33 | const newOrder = new Order({ 34 | id: generateId(), 35 | items: [...this.#items.values()], 36 | totalPrice: this.getTotalPrice(), 37 | address, 38 | user, 39 | }); 40 | store.addNewOrder(newOrder); 41 | } 42 | } 43 | 44 | export default Cart; 45 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/Clothing.js: -------------------------------------------------------------------------------- 1 | class Clothing { 2 | constructor({ 3 | id = 0, 4 | name = "", 5 | price = 0.0, 6 | color = "", 7 | size = "", 8 | material = "", 9 | } = {}) { 10 | this.id = id; 11 | this.name = name; 12 | this.price = price; 13 | this.color = color; 14 | this.size = size; 15 | this.material = material; 16 | } 17 | } 18 | 19 | export default Clothing; 20 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/Jeans.js: -------------------------------------------------------------------------------- 1 | import Clothing from "./Clothing.js"; 2 | 3 | class Jeans extends Clothing { 4 | constructor({ 5 | id = "", 6 | name = "", 7 | price = 0.0, 8 | color = "", 9 | size = "", 10 | material = "", 11 | waist = 0, 12 | inseam = 0, 13 | } = {}) { 14 | super({ id, name, price, color, size, material }); 15 | this.waist = waist; 16 | this.inseam = inseam; 17 | } 18 | } 19 | 20 | export default Jeans; 21 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/Order.js: -------------------------------------------------------------------------------- 1 | class Order { 2 | constructor({ id = 0, items = [], totalPrice, address, user } = {}) { 3 | this.id = id; 4 | this.items = items; 5 | this.totalPrice = totalPrice; 6 | this.address = address; 7 | this.user = user; 8 | } 9 | 10 | displayOrder() { 11 | console.log(`id:\t\t${this.id}, 12 | 商品:\t\t${this.#getOrderItemsDesc(this.items).join("\n\t\t")} 13 | 配送地址:\t${this.address.fullAddress} 14 | 收货人: \t${this.address.name} 15 | 电话: \t${this.address.mobilePhone} 16 | 17 | 总价:\t\t¥${this.totalPrice} 18 | `); 19 | } 20 | 21 | #getOrderItemsDesc(orderItems) { 22 | return orderItems.map( 23 | (orderItem) => 24 | `名称:${orderItem.item.name}\t尺码:${orderItem.item.size}\t数量:${orderItem.count}` 25 | ); 26 | } 27 | } 28 | 29 | export default Order; 30 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/Store.js: -------------------------------------------------------------------------------- 1 | import TShirt from "./TShirt.js"; 2 | import Jeans from "./Jeans.js"; 3 | import { generateId } from "./utils.js"; 4 | class Store { 5 | #list = []; 6 | #orders = []; 7 | 8 | init() { 9 | const tshirt1 = new TShirt({ 10 | id: generateId(), 11 | name: "纯棉宽松 T 恤", 12 | price: 99.0, 13 | color: "黑色", 14 | size: "XL", 15 | material: "纯棉", 16 | chest: 116, 17 | sleeve: 30, 18 | }); 19 | 20 | const tshirt2 = new TShirt({ 21 | id: generateId(), 22 | name: "纯棉修身 T 恤", 23 | price: 89.0, 24 | color: "白色", 25 | size: "L", 26 | material: "涤纶", 27 | chest: 112, 28 | sleeve: 28, 29 | }); 30 | 31 | const jeans1 = new Jeans({ 32 | id: generateId(), 33 | name: "水洗牛仔裤", 34 | price: 129.0, 35 | color: "蓝色", 36 | size: "30", 37 | material: "纯棉", 38 | waist: 77, 39 | inseam: 99, 40 | }); 41 | 42 | const jeans2 = new Jeans({ 43 | id: generateId(), 44 | name: "修身牛仔裤", 45 | price: 159.0, 46 | color: "黑色", 47 | size: "31", 48 | material: "纯棉", 49 | waist: 79, 50 | inseam: 101, 51 | }); 52 | this.#addToList(tshirt1, tshirt2, jeans1, jeans2); 53 | } 54 | 55 | #addToList(...clothes) { 56 | this.#list.push(...clothes); 57 | } 58 | 59 | displayAllClothes() { 60 | const tshirts = []; 61 | const jeans = []; 62 | this.#list.forEach((clothes) => { 63 | if (clothes instanceof TShirt) { 64 | tshirts.push(clothes); 65 | } else if (clothes instanceof Jeans) { 66 | jeans.push(clothes); 67 | } 68 | }); 69 | console.log("上装"); 70 | console.table(tshirts); 71 | console.log("下装"); 72 | console.table(jeans); 73 | } 74 | 75 | selectClothes(index) { 76 | return this.#list[index]; 77 | } 78 | 79 | addNewOrder(order) { 80 | this.#orders.push(order); 81 | } 82 | 83 | displayAllOrders() { 84 | this.#orders.forEach((order) => { 85 | order.displayOrder(); 86 | }); 87 | } 88 | } 89 | 90 | export default Store; 91 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/TShirt.js: -------------------------------------------------------------------------------- 1 | import Clothing from "./Clothing.js"; 2 | 3 | class TShirt extends Clothing { 4 | constructor({ 5 | id = "", 6 | name = "", 7 | price = 0.0, 8 | color = "", 9 | size = "", 10 | material = "", 11 | chest = 0, 12 | sleeve = 0, 13 | } = {}) { 14 | super({ id, name, price, color, size, material }); 15 | this.chest = chest; 16 | this.sleeve = sleeve; 17 | } 18 | } 19 | 20 | export default TShirt; 21 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/User.js: -------------------------------------------------------------------------------- 1 | import Address from "./Address.js"; 2 | import Cart from "./Cart.js"; 3 | import Store from "./Store.js"; 4 | import { generateId } from "./utils.js"; 5 | class User { 6 | #cart = new Cart(); 7 | #shippingAddresses = []; 8 | constructor({ username = "", password = "", mobilePhone = "" }) { 9 | this.username = username; 10 | this.password = password; 11 | this.mobilePhone = mobilePhone; 12 | } 13 | 14 | getCurrentCart() { 15 | return this.#cart; 16 | } 17 | 18 | getShippingAddresses() { 19 | return this.#shippingAddresses; 20 | } 21 | 22 | addShippingAddress({ name, province, city, address, mobilePhone }) { 23 | this.#shippingAddresses.push( 24 | new Address({ 25 | id: generateId(), 26 | name, 27 | province, 28 | city, 29 | address, 30 | mobilePhone, 31 | }) 32 | ); 33 | } 34 | 35 | checkout(store, address) { 36 | this.#cart.checkout(store, address, this); 37 | } 38 | } 39 | 40 | export default User; 41 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 线上服装商城 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/index.js: -------------------------------------------------------------------------------- 1 | import Store from "./Store.js"; 2 | import User from "./User.js"; 3 | 4 | const store = new Store(); 5 | store.init(); 6 | 7 | console.log("==========================================="); 8 | console.log("本店所有衣服列表:"); 9 | console.log("==========================================="); 10 | store.displayAllClothes(); 11 | 12 | const user = new User({ 13 | username: "test", 14 | password: "123456", 15 | mobilePhone: "12345678901", 16 | }); 17 | 18 | const myCart = user.getCurrentCart(); 19 | myCart.addToCart(store.selectClothes(0)); 20 | myCart.addToCart(store.selectClothes(0)); 21 | myCart.addToCart(store.selectClothes(2)); 22 | 23 | console.log("\n==========================================="); 24 | console.log("购物车内容:"); 25 | console.log("==========================================="); 26 | myCart.displayCartContent(); 27 | console.log("==========================================="); 28 | console.log(`总计:¥${myCart.getTotalPrice()}`); 29 | console.log("==========================================="); 30 | 31 | user.addShippingAddress({ 32 | name: "张三", 33 | province: "河北", 34 | city: "石家庄", 35 | address: "XX 路 XX 街 XX 号", 36 | mobilePhone: "21365498712", 37 | }); 38 | 39 | user.checkout(store, user.getShippingAddresses()[0]); 40 | 41 | console.log("\n\n订单信息"); 42 | console.log("-------------------------------------------"); 43 | store.displayAllOrders(); 44 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "online-clothing-store", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC" 13 | } 14 | -------------------------------------------------------------------------------- /chapter14/online-clothing-store/utils.js: -------------------------------------------------------------------------------- 1 | // 生成随机 id 2 | export function generateId() { 3 | return Math.floor(Math.random() * (10000000 - 1000000) + 1000000); 4 | } 5 | -------------------------------------------------------------------------------- /chapter14/super-array/index.js: -------------------------------------------------------------------------------- 1 | export { default as unique } from "./src/unique.js"; 2 | export { default as intersection } from "./src/intersection.js"; 3 | export { default as union } from "./src/union.js"; 4 | export { default as difference } from "./src/difference.js"; 5 | export { default as difference_symm } from "./src/difference_symm.js"; 6 | export { default as mean } from "./src/mean.js"; 7 | export { default as sum } from "./src/sum.js"; 8 | export { default as range } from "./src/range.js"; 9 | export { default as split } from "./src/split.js"; 10 | export { default as count_values } from "./src/count_values.js"; 11 | -------------------------------------------------------------------------------- /chapter14/super-array/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "super-array", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC" 13 | } 14 | -------------------------------------------------------------------------------- /chapter14/super-array/src/count_values.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 计算指定每个元素出现次数 3 | * @param {Array} arr 4 | * @returns {[[]]} 返回包含元素出现次数数组的数组,例如[[1, 2], [3, 5]] 表示 1出现了2次,3出现了5次。 5 | */ 6 | const count_values = (arr) => [ 7 | ...arr 8 | .reduce((acc, cur) => acc.set(cur, (acc.get(cur) || 0) + 1), new Map()) 9 | .entries(), 10 | ]; 11 | 12 | export default count_values; 13 | -------------------------------------------------------------------------------- /chapter14/super-array/src/difference.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 找到存在于 arr1,但是不存在于 arr2 的元素 3 | * @param {Array} arr1 4 | * @param {Array} arr2 5 | * @returns {Array} 差集数组 6 | */ 7 | const difference = (arr1, arr2) => arr1.filter((v) => !arr2.includes(v)); 8 | 9 | export default difference; 10 | -------------------------------------------------------------------------------- /chapter14/super-array/src/difference_symm.js: -------------------------------------------------------------------------------- 1 | import difference from "./difference.js"; 2 | 3 | /** 4 | * 找到存在于 arr1,但是不存在于 arr2 的元素,以及存在于 arr2 但不存在于 arr1 中的元素(对称差集)。 5 | * @param {Array} arr1 6 | * @param {Array} arr2 7 | * @returns {Array} 对称差集结果数组。 8 | */ 9 | const difference_symm = (arr1, arr2) => [ 10 | ...difference(arr1, arr2), 11 | ...difference(arr2, arr1), 12 | ]; 13 | 14 | export default difference_symm; 15 | -------------------------------------------------------------------------------- /chapter14/super-array/src/intersection.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 计算两个数组元素的交集 3 | * @param {Array} arr1 4 | * @param {Array} arr2 5 | * @returns {Array} 交集结果数组 6 | */ 7 | const intersection = (arr1, arr2) => arr1.filter((v) => arr2.includes(v)); 8 | export default intersection; 9 | -------------------------------------------------------------------------------- /chapter14/super-array/src/mean.js: -------------------------------------------------------------------------------- 1 | import sum from "./sum.js"; 2 | 3 | /** 4 | * 计算数组元素的平均值 5 | * @param {Array} arr 6 | * @returns {number} 平均值 7 | */ 8 | const mean = (arr) => sum(arr) / arr.length; 9 | 10 | export default mean; 11 | -------------------------------------------------------------------------------- /chapter14/super-array/src/range.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 返回指定起始数字(包括)到结束数字(不包括)的范围数组 3 | * @param {number} start 起始数字 4 | * @param {number} end 结束数字 5 | * @returns {Array} 范围数组 6 | */ 7 | const range = (start, end) => 8 | [...Array(end - start).keys()].map((i) => i + start); 9 | 10 | export default range; 11 | -------------------------------------------------------------------------------- /chapter14/super-array/src/split.js: -------------------------------------------------------------------------------- 1 | import range from "./range.js"; 2 | 3 | /** 4 | * 把指定数组按指定大小分割成若干子数组。 5 | * @param {Array} arr 指定数组 6 | * @param {number} size 每个子数组有多少个元素 7 | * @returns [[]] 返回包含分割后的子数组的数组 8 | */ 9 | const split = (arr, size) => 10 | range(0, Math.ceil(arr.length / size)).map((i) => 11 | arr.slice(i * size, i * size + size) 12 | ); 13 | 14 | export default split; 15 | -------------------------------------------------------------------------------- /chapter14/super-array/src/sum.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 对指定数组的所有元素进行求和。 3 | * @param {Array} arr 4 | * @returns {number} 5 | */ 6 | const sum = (arr) => arr.reduce((a, b) => a + b); 7 | 8 | export default sum; 9 | -------------------------------------------------------------------------------- /chapter14/super-array/src/union.js: -------------------------------------------------------------------------------- 1 | import unique from "./unique.js"; 2 | 3 | /** 4 | * 计算两个数组的并集,重复元素只包含一次。 5 | * @param {Array} arr1 6 | * @param {Array} arr2 7 | * @returns {Array} 返回并集结果数组 8 | */ 9 | const union = (arr1, arr2) => unique([...arr1, ...arr2]); 10 | 11 | export default union; 12 | -------------------------------------------------------------------------------- /chapter14/super-array/src/unique.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 获取指定数组所有不重复元素的集合 3 | * @param {Array} arr 4 | * @returns {Array} 5 | */ 6 | const unique = (arr) => [...new Set(arr)]; 7 | 8 | export default unique; 9 | -------------------------------------------------------------------------------- /chapter14/super-array/test.js: -------------------------------------------------------------------------------- 1 | import { 2 | difference, 3 | difference_symm, 4 | intersection, 5 | mean, 6 | range, 7 | union, 8 | split, 9 | unique, 10 | count_values, 11 | sum, 12 | } from "./index.js"; 13 | 14 | const arr1 = [1, 3, 5, 7, 9]; 15 | const arr2 = [3, 6, 3, 5, 9, 8, 2, 0, 1]; 16 | 17 | const log = (v) => console.log(JSON.stringify(v)); 18 | 19 | log(unique(arr2)); 20 | log(intersection(arr1, arr2)); 21 | log(union(arr1, arr2)); 22 | log(difference(arr1, arr2)); 23 | log(difference_symm(arr1, arr2)); 24 | log(sum(arr1)); 25 | log(mean(arr1)); 26 | log(range(5, 10)); 27 | log(split(arr2, 4)); 28 | 29 | const arr3 = [1, 3, 5, 5, 5, 3, 2, 2, 1, 1, 0, 5]; 30 | log(count_values(arr3)); 31 | -------------------------------------------------------------------------------- /chapter2/comment1.js: -------------------------------------------------------------------------------- 1 | // chapter2/comment1.js 2 | let num = 10; // 定义底数 3 | // 当条件成立时,进行 XXX 计算 4 | if (someCondition && otherCondition) { 5 | // xxx 6 | } 7 | -------------------------------------------------------------------------------- /chapter2/comment2.js: -------------------------------------------------------------------------------- 1 | // chapter2/comment2.js 2 | /* 3 | * 下边这段代码主要做了如下操作: 4 | * 1. XXX 操作 5 | * 2. YYY 操作 6 | */ 7 | // 代码 8 | -------------------------------------------------------------------------------- /chapter2/comment3.js: -------------------------------------------------------------------------------- 1 | // chapter2/comment3.js 2 | /** 3 | * 用于对两个数字进行相加计算 4 | * @param {number} a 5 | * @param {number} b 6 | * @returns a 与 b 的和 7 | */ 8 | function sum(a, b) { 9 | return a + b; 10 | } 11 | -------------------------------------------------------------------------------- /chapter2/object1.js: -------------------------------------------------------------------------------- 1 | // chapter2/object1.js 2 | let person = { 3 | name: "张三", 4 | age: 20, 5 | student: true, 6 | }; 7 | typeof person; // "object" 8 | -------------------------------------------------------------------------------- /chapter2/string1.js: -------------------------------------------------------------------------------- 1 | // chapter2/string1.js 2 | const str = `这是一个多行文本。 3 | 这一行顶格写,输出的结果也是顶格的。 4 | 这是行有缩进,结果也会缩进。 5 | 这一行有"双引号"、'单引号'符号,它们也会原样输出。 6 | 转义字符\n仍然会生效。如果想再输出\`反引号\`,还需要转义。 7 | `; 8 | console.log(str); 9 | -------------------------------------------------------------------------------- /chapter2/symbol1.js: -------------------------------------------------------------------------------- 1 | // Chapter2/symbol1.js 2 | let obj = {}; 3 | let prop = Symbol("prop"); 4 | let prop2 = Symbol("prop"); 5 | obj[prop] = "value1"; 6 | obj[prop2] = "value2"; 7 | 8 | obj[prop]; // value1 9 | obj[prop2]; // value2 10 | -------------------------------------------------------------------------------- /chapter2/symbol2.js: -------------------------------------------------------------------------------- 1 | // chapter2/symbol2.js 2 | let obj = {}; 3 | obj[Symbol.for("prop")] = "value1"; 4 | obj[Symbol.for("prop")]; // value1 5 | 6 | obj[Symbol.for("prop")] = "value2"; 7 | obj[Symbol.for("prop")]; // value2 8 | -------------------------------------------------------------------------------- /chapter3/addition1.js: -------------------------------------------------------------------------------- 1 | // chapter3/addition1.js 2 | 5 + true; // 6 3 | 5 + null; // 5 4 | 5 + undefined; // NaN 5 | 5 + {}; // "5[object Object]" 6 | 5 + {valueOf() {return 10}}; // 15 7 | 5 + []; // "5" -------------------------------------------------------------------------------- /chapter3/comparison1.js: -------------------------------------------------------------------------------- 1 | // chapter3/comparison1.js 2 | 5 > 6; // false 3 | let a = 10; 4 | a >= 10; // true 5 | a < 4; // false 6 | a < true; // false,这里 true 转换成了数字 1,10 不大于 1,所以返回 false 7 | 99999999n < 100000; // false, BigInt 和 Number 类型可以进行混合比较 8 | -------------------------------------------------------------------------------- /chapter3/comparison2.js: -------------------------------------------------------------------------------- 1 | // chapter3/comparison2.js 2 | 10 == 10; // true 3 | 12 === 12; // true 4 | let a = 5, 5 | b = 5; 6 | a == b; // true 7 | a === b; // true 8 | -------------------------------------------------------------------------------- /chapter3/comparison3.js: -------------------------------------------------------------------------------- 1 | // chapter3/comparison3.js 2 | null === undefined; //false 3 | 1 === true; // false 4 | 0 === false; // false 5 | 1 === "1"; // false 6 | let a = 10, 7 | b = 10; 8 | a === b; // true 9 | -------------------------------------------------------------------------------- /chapter3/comparison4.js: -------------------------------------------------------------------------------- 1 | // chapter3/comparison4.js 2 | let a = { x: 1 }, 3 | b = { x: 1 }; 4 | a === b; // false 5 | a == b; // false 6 | let c = a; 7 | a === c; // true 8 | a == c; // true 9 | -------------------------------------------------------------------------------- /chapter3/logical1.js: -------------------------------------------------------------------------------- 1 | // chapter3/logical1.js 2 | let min = 10; 3 | let max = 100; 4 | let value = 25; 5 | value >= min && value <= max; // true 6 | value = 125; 7 | value >= min || value <= max; // true 8 | !(value >= min); // false 9 | -------------------------------------------------------------------------------- /chapter3/substraction1.js: -------------------------------------------------------------------------------- 1 | // chapter3/substraction1.js 2 | 10 - 1; // 9 3 | 10 - true; // 9 4 | 10 - null; // 10 5 | 10 - "5"; // 5 6 | 10 - -5; // 15,含义为10减去-5,两个减号中间需要有空格,否则会被认为是自减 7 | 10 - "str"; // NaN 8 | -------------------------------------------------------------------------------- /chapter4/continue1.js: -------------------------------------------------------------------------------- 1 | // chapter4/continue1.js 2 | let sum = 0; 3 | for (let i = 1; i <= 5; i++) { 4 | if (i === 3) { 5 | continue; 6 | } 7 | sum += i; 8 | } 9 | console.log(sum); 10 | -------------------------------------------------------------------------------- /chapter4/for1.js: -------------------------------------------------------------------------------- 1 | // chatper4/for1.js 2 | for (let i = 1; i <= 10; i++) { 3 | for (let j = 5; j <= 10; j++) { 4 | console.log("i * j = ", i * j); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /chapter4/for2.js: -------------------------------------------------------------------------------- 1 | // chapter4/for2.js 2 | let sum = 0; 3 | for (let i = 1; i <= 5; i++) { 4 | if (sum > 5) { 5 | break; 6 | } 7 | sum += i; 8 | } 9 | console.log(sum); 10 | -------------------------------------------------------------------------------- /chapter4/ifelse1.js: -------------------------------------------------------------------------------- 1 | // chapter4/ifelse1.js 2 | let a = 5; 3 | if (a > 5) { 4 | console.log("a 大于 5"); 5 | } else { 6 | console.log("a 小于等于 5"); 7 | } 8 | -------------------------------------------------------------------------------- /chapter4/ifelse2.js: -------------------------------------------------------------------------------- 1 | // chapter4/ifelse2.js 2 | let a = ""; 3 | if (a) { 4 | console.log("a 有值"); 5 | } else { 6 | console.log("a 无值"); 7 | } 8 | -------------------------------------------------------------------------------- /chapter4/ifelse3.js: -------------------------------------------------------------------------------- 1 | // chapter4/ifelse3.js 2 | let a = 10; 3 | if (a > 5) { 4 | if (a > 8) { 5 | console.log("a 大于 8"); 6 | } 7 | } else { 8 | console.log("a 小于等于 5"); 9 | } 10 | -------------------------------------------------------------------------------- /chapter4/ifelseifelse1.js: -------------------------------------------------------------------------------- 1 | // chapter4/ifelseifelse1.js 2 | let a = 10; 3 | 4 | if (a > 15) { 5 | console.log("a 大于 15"); 6 | } else if (a === 10) { 7 | console.log("a 等于 10"); 8 | } else { 9 | console.log("a 小于等于 15"); 10 | } 11 | -------------------------------------------------------------------------------- /chapter4/label1.js: -------------------------------------------------------------------------------- 1 | outer: for (let i = 0; i < 10; i++) { 2 | for (let j = 0; j < 8; j++) { 3 | if (j === 3) { 4 | break outer; 5 | } 6 | console.log(i + j); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /chapter4/label2.js: -------------------------------------------------------------------------------- 1 | assignment: { 2 | let a = 1; 3 | { 4 | break assignment; 5 | } 6 | console.log(a); 7 | } 8 | 9 | console.log("done"); 10 | -------------------------------------------------------------------------------- /chapter4/switchcase1.js: -------------------------------------------------------------------------------- 1 | // chapter4/switch_case1.js 2 | let a = 10; 3 | switch (a) { 4 | case 5: 5 | console.log("5"); 6 | break; 7 | case 10: 8 | console.log("10"); 9 | break; 10 | case 12: 11 | console.log("12"); 12 | break; 13 | default: 14 | console.log("0"); 15 | break; 16 | } 17 | -------------------------------------------------------------------------------- /chapter4/while1.js: -------------------------------------------------------------------------------- 1 | // chapter4/while1.js 2 | let n = 5; 3 | while (n <= 10) { 4 | console.log(n); 5 | n++; 6 | } 7 | -------------------------------------------------------------------------------- /chapter5/callback1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * // chapter5/callback1.js 3 | * @param {object} user 用户数据 4 | * @param {(success: boolean) => void} callback 5 | */ 6 | function addUser(user, callback) { 7 | console.log(`保存 ${user.username} 成功!`); 8 | callback(true); 9 | } 10 | 11 | addUser({ username: "user" }, function (success) { 12 | if (success) { 13 | // 成功后的操作 14 | console.log(`添加成功!`); 15 | } 16 | }); 17 | -------------------------------------------------------------------------------- /chapter5/closure1.js: -------------------------------------------------------------------------------- 1 | // chapter5/closure1.js 2 | function sayHello(name) { 3 | function message() { 4 | console.log("你好!" + name); 5 | } 6 | message(); 7 | } 8 | sayHello("李明"); // 你好!李明 9 | -------------------------------------------------------------------------------- /chapter5/closure2.js: -------------------------------------------------------------------------------- 1 | // chapter5/closure2.js 2 | const myData = function data() { 3 | let arr = [1, 3, 5, 7, 9]; 4 | let index = 0; 5 | return { 6 | value() { 7 | return arr[index]; 8 | }, 9 | next() { 10 | index = ++index % arr.length; 11 | }, 12 | pre() { 13 | index = (--index + arr.length) % arr.length; 14 | }, 15 | }; 16 | }; 17 | 18 | // const myData = data(); 19 | console.log(myData.value()); 20 | myData.next(); 21 | myData.next(); 22 | console.log(myData.value()); 23 | 24 | myData.pre(); 25 | myData.pre(); 26 | myData.pre(); 27 | console.log(myData.value()); 28 | -------------------------------------------------------------------------------- /chapter5/closure_for_loop1.js: -------------------------------------------------------------------------------- 1 | // chapter5/cloures_for_loop1.js 2 | for (var i = 0; i < 3; i++) { 3 | setTimeout(() => { 4 | console.log(i); 5 | }); 6 | } 7 | 8 | // 使用立即执行函数 9 | for (var i = 0; i < 3; i++) { 10 | (function (i) { 11 | setTimeout(() => { 12 | console.log(i); 13 | }); 14 | })(i); 15 | } 16 | -------------------------------------------------------------------------------- /chapter5/closure_inc1.js: -------------------------------------------------------------------------------- 1 | // chapter5/closure_inc1.js 2 | function increment(initialValue, step) { 3 | return initialValue + step; 4 | } 5 | 6 | let result = increment(10, 1); 7 | result = increment(result, 1); 8 | result = increment(result, 2); 9 | console.log(result); 10 | -------------------------------------------------------------------------------- /chapter5/closure_inc2.js: -------------------------------------------------------------------------------- 1 | // chapter5/closure_inc2.js 2 | function increment(initialValue) { 3 | let result = initialValue; 4 | return function by(step) { 5 | result += step; 6 | return result; 7 | }; 8 | } 9 | 10 | const incFiveBy = increment(5); 11 | console.log(incFiveBy(2)); // 7 12 | console.log(incFiveBy(4)); // 11 13 | 14 | const incTenBy = increment(10); 15 | console.log(incTenBy(3)); // 13 16 | console.log(incTenBy(5)); // 18 17 | console.log(incFiveBy(1)); // 12 18 | -------------------------------------------------------------------------------- /chapter5/closure_inc3.js: -------------------------------------------------------------------------------- 1 | // chapter5/closure_inc3.js 2 | function increment(initialValue) { 3 | let result = initialValue; 4 | return function by(step) { 5 | result += step; 6 | return result; 7 | }; 8 | } 9 | const incFiveBy = increment(5); 10 | const incFiveByTwo = () => incFiveBy(2); 11 | const incFiveByFour = () => incFiveBy(4); 12 | 13 | console.log(incFiveByTwo()); // 7 14 | console.log(incFiveByFour()); // 11 15 | console.log(incFiveByFour()); // 15 16 | -------------------------------------------------------------------------------- /chapter5/currying1.js: -------------------------------------------------------------------------------- 1 | // chapter5/currying1.js 2 | function usdToCny(amount, rate) { 3 | return amount * rate; 4 | } 5 | console.log(usdToCny(1, 6.78)); 6 | console.log(usdToCny(8, 6.78)); 7 | 8 | function convertRate(rate) { 9 | return (amount) => amount * rate; 10 | } 11 | 12 | // 普通调用 13 | // console.log(convertRate(6.78)(10)); // 67.8 14 | 15 | // 记录中间值 16 | const uToC = convertRate(6.78); 17 | console.log(uToC(1)); // 6.78 18 | console.log(uToC(8)); // 54.24 19 | 20 | const cToJ = convertRate(15.74); 21 | const uToJ = (amount) => cToJ(uToC(amount)); 22 | console.log(uToJ(2)); 23 | -------------------------------------------------------------------------------- /chapter5/higher_order_func1.js: -------------------------------------------------------------------------------- 1 | // chapter5/higher_order_func1.js 2 | function square(f) { 3 | return (...args) => f(...args) ** 2; 4 | } 5 | const sum = (a, b) => a + b; 6 | const squareOfSum = square(sum); 7 | console.log(squareOfSum(1, 2)); 8 | 9 | const diff = (a, b, c) => a - b - c; 10 | const squareOfDiff = square(diff); 11 | console.log(squareOfDiff(9, 2, 1)); 12 | -------------------------------------------------------------------------------- /chapter5/hoisting1.js: -------------------------------------------------------------------------------- 1 | // chapter5/hoisting1.js 2 | function func() { 3 | return x; 4 | x = 5; 5 | function x() {} 6 | var x; 7 | } 8 | console.log(func()); 9 | -------------------------------------------------------------------------------- /chapter5/memoization1.js: -------------------------------------------------------------------------------- 1 | // chapter5/memoization1.js 2 | function fib(n) { 3 | if (n <= 1) return n; 4 | return fib(n - 1) + fib(n - 2); 5 | } 6 | const start = new Date().getTime(); 7 | console.log(fib(50)); 8 | const end = new Date().getTime(); 9 | console.log(`总计执行了:${end - start} 毫秒`); 10 | -------------------------------------------------------------------------------- /chapter5/memoization2.js: -------------------------------------------------------------------------------- 1 | // chapter5/memoization2.js 2 | function fib(n) { 3 | if (n <= 1) return n; 4 | if (fib[n]) return fib[n]; 5 | fib[n] = fib(n - 1) + fib(n - 2); 6 | return fib[n]; 7 | } 8 | const start = new Date().getTime(); 9 | console.log(fib(50)); 10 | const end = new Date().getTime(); 11 | console.log(`总计执行了:${end - start} 毫秒`); 12 | -------------------------------------------------------------------------------- /chapter5/memoization3.js: -------------------------------------------------------------------------------- 1 | // chapter5/memoization3.js 2 | function memoize(fn) { 3 | let cache = {}; 4 | return function (...args) { 5 | if (cache[args]) return cache[args]; 6 | cache[args] = fn(...args); 7 | return cache[args]; 8 | }; 9 | } 10 | 11 | const fib = memoize(function (n) { 12 | if (n <= 1) return n; 13 | return fib(n - 1) + fib(n - 2); 14 | }); 15 | 16 | const start = new Date().getTime(); 17 | console.log(fib(50)); 18 | const end = new Date().getTime(); 19 | console.log(`总计执行了:${end - start} 毫秒`); 20 | -------------------------------------------------------------------------------- /chapter5/optional_params1.js: -------------------------------------------------------------------------------- 1 | // chapter5/optional_params1.js 2 | // options 为可选参数 3 | function init(arg1, arg2, options) { 4 | // 初始化操作 5 | if (options) { 6 | // 自定义配置 7 | } 8 | } 9 | init("value1", "value2"); 10 | init("value1", "value2", { prop: "value" }); 11 | -------------------------------------------------------------------------------- /chapter5/optional_params2.js: -------------------------------------------------------------------------------- 1 | // chapter5/optional_params2.js 2 | let defaultColor = "#02cf13"; 3 | function drawRect(width = 10, height = width / 2, color = defaultColor) { 4 | console.log(width, height, color); 5 | } 6 | drawRect(); // 10 5 #02cf13。 7 | -------------------------------------------------------------------------------- /chapter5/pure_function1.js: -------------------------------------------------------------------------------- 1 | // chapter5/pure_function1.js 2 | // 修改了按引用传递的参数的值,data 对象发生了变化 3 | function update(data) { 4 | data.id = 5; 5 | } 6 | const data = { id: 1 }; 7 | update(data); 8 | 9 | // 网络请求,有可能出错,也有可能后端数据变化 10 | async function getData() { 11 | const res = await fetch("http://test.com/api"); 12 | return await res.json(); 13 | } 14 | -------------------------------------------------------------------------------- /chapter5/recursion1.js: -------------------------------------------------------------------------------- 1 | // chapter5/recursion1.js 2 | function addUp(n) { 3 | if (n <= 0) return 0; 4 | return n + addUp(n - 1); 5 | } 6 | console.log(addUp(10)); 7 | 8 | function addUpIterative(n) { 9 | let sum = 0; 10 | for (let i = 1; i <= n; i++) { 11 | sum += i; 12 | } 13 | return sum; 14 | } 15 | console.log(addUpIterative(10)); 16 | -------------------------------------------------------------------------------- /chapter5/scope1.js: -------------------------------------------------------------------------------- 1 | // chapter5/scope1.js 2 | var x = 10; 3 | globalThis.x; // 10; 4 | var x = "Hello"; 5 | globalThis.x; // "Hello" 6 | -------------------------------------------------------------------------------- /chapter5/scope2.js: -------------------------------------------------------------------------------- 1 | // chapter5/scope2.js 2 | let x = 5; 3 | function outerFunc() { 4 | let x = 4; 5 | function innerFunc() { 6 | let x = 7; 7 | console.log(x); 8 | } 9 | console.log(x); 10 | 11 | return innerFunc; 12 | } 13 | 14 | let innerFunc = outerFunc(); 15 | 16 | innerFunc(); 17 | 18 | console.log(x); 19 | -------------------------------------------------------------------------------- /chapter5/scope3.js: -------------------------------------------------------------------------------- 1 | // chapter5/scope3.js 2 | { 3 | let i = 10; 4 | } 5 | console.log(i); // 引用错误,i 未定义 6 | 7 | for (let j = 0; j < 10; j++) {} 8 | console.log(j); // 引用错误,j 未定义 9 | -------------------------------------------------------------------------------- /chapter5/varargs1.js: -------------------------------------------------------------------------------- 1 | // chapter5/varargs1.js 2 | function joinStrings(seperator) { 3 | let result = ""; 4 | for (let i = 1; i < arguments.length; i++) { 5 | if (i > 1) { 6 | result += seperator; 7 | } 8 | result += arguments[i]; 9 | } 10 | return result; 11 | } 12 | 13 | console.log(joinStrings(", ", "react", "node")); 14 | -------------------------------------------------------------------------------- /chapter5/varargs2.js: -------------------------------------------------------------------------------- 1 | // chapter5/varargs2.js 2 | function joinStrings(seperator, ...strs) { 3 | return strs.join(seperator); 4 | } 5 | 6 | console.log(joinStrings(", ", "react", "node")); 7 | -------------------------------------------------------------------------------- /chapter6/array1.js: -------------------------------------------------------------------------------- 1 | // chapter6/array1.js 2 | let arr = [1, 2, 3, 4, 5]; 3 | arr["0"]; // 1 4 | arr[arr[2]]; // 4,相当于 arr[3] 5 | let index = 1; 6 | arr[index]; // 2 7 | -------------------------------------------------------------------------------- /chapter6/array2.js: -------------------------------------------------------------------------------- 1 | // chapter6/array2.js 2 | let stack = []; 3 | stack.push(1, 2, 3); // 3,stack:[1, 2, 3] 4 | stack.pop(); // 3 5 | stack; // stack:[1, 2] 6 | stack[stack.length - 1]; // 2,查看栈顶元素 7 | 8 | let queue = []; 9 | queue.unshift(1, 2, 3); // 3,queue: [1, 2, 3] 10 | queue.shift(); // 1,queue: [2, 3] 11 | queue[0]; // 2,查看队首元素 12 | -------------------------------------------------------------------------------- /chapter6/array_da1.js: -------------------------------------------------------------------------------- 1 | // chapter6/array_da1.js 2 | const [a, b, ...rest] = [1, 10, 23, 45, 32]; 3 | a; // 1 4 | b; // 10 5 | rest; // [23, 45, 32] 6 | -------------------------------------------------------------------------------- /chapter6/array_da2.js: -------------------------------------------------------------------------------- 1 | // chapter6/array_da2.js 2 | let arr = [1, 2, 3, 4]; 3 | // 更改 2、3、4 的位置 4 | [arr[3], arr[2], arr[1]] = [arr[1], arr[2], arr[3]]; 5 | arr; // [1, 4, 3, 2] 6 | -------------------------------------------------------------------------------- /chapter6/array_sort1.js: -------------------------------------------------------------------------------- 1 | // chapter6/array_sort1.js 2 | [82, 71, 99, 4, 10, 120].sort((a, b) => { 3 | if (a > b) return 1; 4 | if (a < b) return -1; 5 | if (a === b) return 0; 6 | }); // [4, 10, 71, 82, 99, 120] 7 | -------------------------------------------------------------------------------- /chapter7/apply1.js: -------------------------------------------------------------------------------- 1 | // chapter7/apply1.js 2 | const arr1 = [1, 2, 3]; 3 | const arr2 = [4, 5, 6]; 4 | 5 | arr1.push.apply(arr1, arr2); 6 | arr1; // [ 1, 2, 3, 4, 5, 6 ] 7 | -------------------------------------------------------------------------------- /chapter7/array_like1.js: -------------------------------------------------------------------------------- 1 | // chapter7/array_like1.js 2 | let arrLike = { 0: "a", 1: "b", 2: "c", length: 3 }; 3 | console.log(arrLike[0]); 4 | for (let i = 0; i < arrLike.length; i++) { 5 | console.log(arrLike[i]); 6 | } 7 | -------------------------------------------------------------------------------- /chapter7/bind1.js: -------------------------------------------------------------------------------- 1 | // chapter7/bind1.js 2 | const obj = { 3 | a: 1, 4 | f(b) { 5 | return this.a + b; 6 | }, 7 | }; 8 | 9 | const f = obj.f; 10 | console.log(f(10)); // NaN 11 | const boundF = f.bind(obj); 12 | console.log(boundF(10)); // 11 13 | -------------------------------------------------------------------------------- /chapter7/bind2.js: -------------------------------------------------------------------------------- 1 | // chapter/bind2.js 2 | function buildPath(dir, fileName) { 3 | return `${dir}/${fileName}`; 4 | } 5 | 6 | const usr = buildPath.bind(null, "/usr"); 7 | console.log(usr("image.jpg")); // /usr/image.jpg 8 | -------------------------------------------------------------------------------- /chapter7/bind3.js: -------------------------------------------------------------------------------- 1 | // chapter7/bind3.js 2 | function curry(func) { 3 | return function _curry(...args) { 4 | if (args.length >= func.length) { 5 | return func.apply(null, args); 6 | } else { 7 | return _curry.bind(null, ...args); 8 | } 9 | }; 10 | } 11 | 12 | function add(a, b, c) { 13 | return a + b + c; 14 | } 15 | 16 | const addCurry = curry(add); 17 | 18 | console.log(addCurry(2)(4)(10)); 19 | console.log(addCurry(1, 3)(6)); 20 | console.log(addCurry(4)(5, 7)); 21 | -------------------------------------------------------------------------------- /chapter7/byvalue_byref1.js: -------------------------------------------------------------------------------- 1 | // chapter7/byvalue_byref1.js 2 | // 按值传递 3 | function byValue(x) { 4 | x = 10; 5 | } 6 | let x = 5; 7 | byValue(x); 8 | console.log(x); // 5 9 | 10 | // 按引用传递 11 | function byRef(obj) { 12 | obj.x = 12; 13 | } 14 | const obj = { 15 | x: 8, 16 | }; 17 | byRef(obj); 18 | console.log(obj.x); // 12 19 | -------------------------------------------------------------------------------- /chapter7/call1.js: -------------------------------------------------------------------------------- 1 | // chapter7/call1.js 2 | function sum(prop1, prop2) { 3 | return this[prop1] + this[prop2]; 4 | } 5 | 6 | // console.log(sum("a", "b")); // NaN 7 | 8 | const obj = { a: 1, b: 2 }; 9 | const result = sum.call(obj, "a", "b"); 10 | console.log(result); // 3 11 | -------------------------------------------------------------------------------- /chapter7/call2.js: -------------------------------------------------------------------------------- 1 | // chapter7/call2.js 2 | function Message(message, sender) { 3 | this.message = message; 4 | this.sender = sender; 5 | } 6 | 7 | function TextMessage(message, sender) { 8 | Message.call(this, message, sender); 9 | this.msgType = "文本消息"; 10 | } 11 | 12 | function EmojMessage(message, sender) { 13 | Message.call(this, message, sender); 14 | this.msgType = "表情消息"; 15 | } 16 | 17 | const txtMsg = new TextMessage("你好", "张三"); 18 | const emjMsg = new EmojMessage("😄", "李四"); 19 | 20 | console.log(txtMsg.message, txtMsg.msgType); 21 | console.log(emjMsg.message, emjMsg.msgType); 22 | -------------------------------------------------------------------------------- /chapter7/computed_property_names1.js: -------------------------------------------------------------------------------- 1 | // chapter7/computed_property_names1.js 2 | const customProperty = "price"; 3 | const customValue = "12.00"; 4 | 5 | const blogPost = { 6 | [customProperty]: customValue, 7 | // 其它属性 8 | }; 9 | -------------------------------------------------------------------------------- /chapter7/constructor1.js: -------------------------------------------------------------------------------- 1 | // chapter7/constructor1.js 2 | function Message(message, sender) { 3 | this.message = message; 4 | this.sender = sender; 5 | } 6 | 7 | const msg = new Message("你好", "张三"); 8 | console.log(msg.message, msg.sender); 9 | const msg2 = new Message("明天见", "李四"); 10 | console.log(msg2.message, msg2.sender); 11 | -------------------------------------------------------------------------------- /chapter7/constructor2.js: -------------------------------------------------------------------------------- 1 | // chapter7/constructor2.js 2 | function Message(message, sender) { 3 | this.message = message; 4 | this.sender = sender; 5 | } 6 | 7 | const msg = new Message("你好", "张三"); 8 | const msg2 = new Message("明天见", "李四"); 9 | 10 | Message.prototype.getMessage = function () { 11 | return this.message + " 发自:" + this.sender; 12 | }; 13 | 14 | console.log(msg.getMessage()); 15 | console.log(msg2.getMessage()); 16 | -------------------------------------------------------------------------------- /chapter7/constructor3.js: -------------------------------------------------------------------------------- 1 | // chapter7/constructor3.js 2 | function Message(message, sender) { 3 | this.message = message; 4 | this.sender = sender; 5 | } 6 | 7 | Message.prototype = { 8 | constructor: Message, 9 | msgType: "文本", 10 | getMessage() { 11 | return this.message + " 发自:" + this.sender; 12 | }, 13 | }; 14 | 15 | const msg = new Message("你好", "张三"); 16 | const msg2 = new Message("明天见", "李四"); 17 | 18 | console.log(msg.msgType); 19 | -------------------------------------------------------------------------------- /chapter7/da_rest1.js: -------------------------------------------------------------------------------- 1 | // chapter7/da_rest1.js 2 | const post = { 3 | id: 1, 4 | title: "如何学好 JavaScript", 5 | comments: [ 6 | { 7 | id: 1, 8 | content: "好!", 9 | user: { 10 | id: 10, 11 | name: "张三", 12 | }, 13 | }, 14 | { 15 | id: 2, 16 | content: "Very good!", 17 | user: { 18 | id: 11, 19 | name: "李四", 20 | }, 21 | }, 22 | ], 23 | }; 24 | 25 | const { 26 | title, 27 | comments: [ 28 | , 29 | { 30 | content: comment2Content, 31 | user: { name }, 32 | }, 33 | ], 34 | } = post; 35 | 36 | console.log(title, comment2Content, name); 37 | -------------------------------------------------------------------------------- /chapter7/da_rest2.js: -------------------------------------------------------------------------------- 1 | // chapter7/da_rest2.js 2 | function init({ host = "localhost", port = 3000, ...rest }) { 3 | console.log(host, port); 4 | next(rest); 5 | } 6 | function next(params) { 7 | console.log(params); 8 | } 9 | 10 | init({ host: "example.com", username: "johnsmith" }); 11 | -------------------------------------------------------------------------------- /chapter7/descriptor1.js: -------------------------------------------------------------------------------- 1 | // chapter7/descriptor1.js 2 | const obj = {}; 3 | Object.defineProperty(obj, "a", { 4 | value: 1, 5 | configurable: false, 6 | enumerable: false, 7 | writable: false, 8 | }); 9 | 10 | console.log(obj.a); 11 | obj.a = 2; 12 | console.log(obj.a); 13 | delete obj.a; 14 | console.log(obj.a); 15 | console.log(Object.keys(obj)); 16 | -------------------------------------------------------------------------------- /chapter7/descriptor2.js: -------------------------------------------------------------------------------- 1 | // chapter7/descriptor2.js 2 | const counter = { 3 | count: 1, 4 | }; 5 | Object.defineProperty(counter, "current", { 6 | get() { 7 | return this.count; 8 | }, 9 | set(value) { 10 | this.count = value; 11 | }, 12 | }); 13 | 14 | console.log(counter.current); 15 | counter.current = 10; 16 | console.log(counter.current); 17 | -------------------------------------------------------------------------------- /chapter7/descriptor3.js: -------------------------------------------------------------------------------- 1 | // chapter7/descriptor3.js 2 | const obj = {}; 3 | Object.defineProperty(obj, "a", { 4 | configurable: false, 5 | enumerable: false, 6 | writable: true, 7 | }); 8 | 9 | Object.defineProperty(obj, "a", { 10 | configurable: true, 11 | }); 12 | 13 | Object.defineProperty(obj, "a", { 14 | enumerable: true, 15 | }); 16 | 17 | Object.defineProperty(obj, "a", { 18 | writable: false, 19 | }); // 正常,可以将 writable 从 true 改为 false 20 | 21 | Object.defineProperty(obj, "a", { 22 | writable: true, 23 | }); // 改为 false 后,无法再改成 true 24 | 25 | Object.defineProperty(obj, "a", { 26 | get() { 27 | return 1; 28 | }, 29 | set(value) { 30 | this.a = value; 31 | }, 32 | }); 33 | -------------------------------------------------------------------------------- /chapter7/getters_setters1.js: -------------------------------------------------------------------------------- 1 | // chapter7/getters_setters1.js 2 | const cart = { 3 | items: ["商品 1", "商品 2", "商品 3"], 4 | get total() { 5 | return this.items.length; 6 | }, 7 | }; 8 | 9 | console.log(cart.total); 10 | cart.total = 5; 11 | console.log(cart.total); 12 | -------------------------------------------------------------------------------- /chapter7/getters_setters2.js: -------------------------------------------------------------------------------- 1 | // chapter7/getters_setters2.js 2 | const user = { 3 | _username: "", 4 | set username(value) { 5 | if (value.length >= 5) { 6 | this._username = value; 7 | } 8 | }, 9 | get username() { 10 | return this._username; 11 | }, 12 | }; 13 | user.username = "testuser"; 14 | console.log(user.username); 15 | -------------------------------------------------------------------------------- /chapter7/iterating_properties1.js: -------------------------------------------------------------------------------- 1 | // chapter7/iterating_properties1.js 2 | const blogPost = { 3 | id: 1, 4 | title: "JavaScript 教程", 5 | getSlug: function () { 6 | return "/post/" + this.title; 7 | }, 8 | author: "李明", 9 | comments: ["很好", "受教了", "加油"], 10 | "update-at": "2020-10-26", 11 | }; 12 | 13 | console.log(Object.keys(blogPost)); 14 | Object.keys(blogPost).forEach((key) => { 15 | console.log(`${key}: ${blogPost[key]}`); 16 | }); 17 | -------------------------------------------------------------------------------- /chapter7/iterating_properties2.js: -------------------------------------------------------------------------------- 1 | // chapter7/iterating_properties2.js 2 | const blogPost = { 3 | id: 1, 4 | title: "JavaScript 教程", 5 | getSlug: function () { 6 | return "/post/" + title; 7 | }, 8 | author: "李明", 9 | comments: ["很好", "受教了", "加油"], 10 | "update-at": "2020-10-26", 11 | }; 12 | 13 | for (let key in blogPost) { 14 | console.log(`${key}: ${blogPost[key]}`); 15 | } 16 | -------------------------------------------------------------------------------- /chapter7/object1.js: -------------------------------------------------------------------------------- 1 | // chapter7/object1.js 2 | const blogPost = { 3 | id: 1, 4 | title: "JavaScript 教程", 5 | getSlug: function () { 6 | return "/post/" + this.title; 7 | }, 8 | "updated-at": "2020-10-26", 9 | }; 10 | -------------------------------------------------------------------------------- /chapter7/object2.js: -------------------------------------------------------------------------------- 1 | // chapter7/object2.js 2 | const title = getUserInput(); 3 | 4 | const blogPost = { 5 | id: 1, 6 | title, 7 | getSlug() { 8 | return "/post/" + this.title; 9 | }, 10 | "update-at": "2020-10-26", 11 | }; 12 | 13 | /** 14 | * 模拟获取用户输入的函数 15 | */ 16 | function getUserInput() { 17 | return "JavaScript 教程"; 18 | } 19 | -------------------------------------------------------------------------------- /chapter7/object3.js: -------------------------------------------------------------------------------- 1 | // chapter7/object3.js 2 | const blogPost = { 3 | id: 1, 4 | title: "JavaScript 教程", 5 | getSlug: function () { 6 | return "/post/" + this.title; 7 | }, 8 | "update-at": "2020-10-26", 9 | }; 10 | 11 | blogPost.title; // "JavaScript 教程" 12 | blogPost.getSlug(); // /post/JavaScript 教程 13 | blogPost.author; // undefined 14 | -------------------------------------------------------------------------------- /chapter7/object_create1.js: -------------------------------------------------------------------------------- 1 | // chapter7/object_create1.js 2 | const obj = { 3 | a: 1, 4 | f() { 5 | return 5; 6 | }, 7 | }; 8 | 9 | const newObj = Object.create(obj); 10 | newObj.b = 2; 11 | 12 | console.log(newObj.b); 13 | console.log(newObj.a); 14 | console.log(newObj.f()); 15 | console.log(Object.getPrototypeOf(newObj)); 16 | -------------------------------------------------------------------------------- /chapter7/prototype1.js: -------------------------------------------------------------------------------- 1 | // chapter7/prototype1.js 2 | let arr = [1, 2, 3]; 3 | let p1 = Object.getPrototypeOf(arr); 4 | p1; // [constructor: ƒ, concat: ƒ, copyWithin: ƒ, fill: ƒ, find: ƒ, …] 5 | p1 === Array.prototype; // true 6 | let p2 = Object.getPrototypeOf(p1); 7 | p2; // {constructor: ƒ, __defineGetter__: ƒ, __defineSetter__: ƒ,…} 8 | p2 === Object.prototype; // true 9 | let p3 = Object.getPrototypeOf(p2); 10 | p3; // null 11 | -------------------------------------------------------------------------------- /chapter7/seal1.js: -------------------------------------------------------------------------------- 1 | // chapter7/seal1.js 2 | const obj = { a: 1 }; 3 | Object.seal(obj); 4 | console.log(Object.isSealed(obj)); // true 5 | obj.b = 5; // 无效 6 | console.log(obj.b); // undefined 7 | obj.a = 10; 8 | console.log(obj.a); // 10 9 | delete obj.a; 10 | console.log(obj.a); // 10 11 | -------------------------------------------------------------------------------- /chapter7/this1.js: -------------------------------------------------------------------------------- 1 | // chapter7/this1.js 2 | const obj = { 3 | a: 1, 4 | f() { 5 | console.log(obj === this); 6 | console.log(this.a); 7 | }, 8 | }; 9 | obj.f(); 10 | -------------------------------------------------------------------------------- /chapter7/this2.js: -------------------------------------------------------------------------------- 1 | // chapter7/this2.js 2 | function Func() { 3 | const init = () => { 4 | this.a = 5; 5 | }; 6 | init(); 7 | } 8 | const obj = new Func(); 9 | console.log(obj.a); 10 | -------------------------------------------------------------------------------- /chapter7/this3.js: -------------------------------------------------------------------------------- 1 | // function Button(label) { 2 | // this.label = label; 3 | // this.handleClick = function () { 4 | // console.log(this.label); 5 | // }; 6 | // } 7 | // 模拟触发点击事件 8 | function emitClick(callback) { 9 | callback(); 10 | } 11 | 12 | const btn = new Button("按钮"); 13 | emitClick(btn.handleClick); 14 | 15 | // 解决方法 1 16 | // function Button(label) { 17 | // this.label = label; 18 | // var self = this; 19 | // this.handleClick = function () { 20 | // console.log(self.label); 21 | // }; 22 | // } 23 | 24 | // 解决方法 2 25 | // function Button(label) { 26 | // this.label = label; 27 | // this.handleClick = () => { 28 | // console.log(this.label); 29 | // }; 30 | // } 31 | 32 | // 解决方法 3 33 | // function Button(label) { 34 | // this.label = label; 35 | // this.handleClick = function () { 36 | // console.log(this.label); 37 | // }.bind(this); 38 | // } 39 | -------------------------------------------------------------------------------- /chapter7/toString1.js: -------------------------------------------------------------------------------- 1 | // chapter7/toString1.js 2 | const obj = { 3 | a: 1, 4 | b: 2, 5 | toString() { 6 | return `a=${this.a}, b=${this.b}`; 7 | }, 8 | }; 9 | 10 | console.log(obj.toString()); 11 | console.log("对象字符串为:" + obj); 12 | -------------------------------------------------------------------------------- /chapter7/valueOf1.js: -------------------------------------------------------------------------------- 1 | // chapter7/valueOf1.js 2 | const obj = { 3 | a: 1, 4 | b: 2, 5 | valueOf() { 6 | return this.a + this.b; 7 | }, 8 | }; 9 | 10 | console.log(obj.valueOf()); 11 | console.log(+obj); 12 | console.log(obj - 2); 13 | -------------------------------------------------------------------------------- /chapter7/with1.js: -------------------------------------------------------------------------------- 1 | let emp = { 2 | name: "张三", 3 | dept: { 4 | name: "信息技术部", 5 | manager: "李四", 6 | }, 7 | }; 8 | 9 | with (emp) { 10 | console.log(name); // 张三 11 | console.log(dept.name); // 信息技术部 12 | } 13 | 14 | with (emp.dept) { 15 | console.log(name); // 信息技术部 16 | console.log(manager); // 李四 17 | } 18 | 19 | const dept = emp.dept; 20 | console.log(dept.name); // 信息技术部 21 | console.log(dept.manager); // 李四 22 | 23 | const { name: empName } = emp; 24 | const { name: deptName, manager } = emp.dept; 25 | 26 | console.log(empName); // 张三 27 | console.log(deptName); // 信息技术部 28 | console.log(manager); // 李四 29 | -------------------------------------------------------------------------------- /chapter8/abstract_class1.js: -------------------------------------------------------------------------------- 1 | // chapter8/abstract_class1.js 2 | class AbstractShape { 3 | constructor() { 4 | if (new.target === AbstractShape) { 5 | throw "不能直接初始化抽象类"; 6 | } 7 | } 8 | 9 | draw() { 10 | throw "未定义"; 11 | } 12 | } 13 | 14 | class Rectangle extends AbstractShape { 15 | draw() { 16 | console.log("绘制矩形"); 17 | } 18 | } 19 | 20 | class Circle extends AbstractShape { 21 | draw() { 22 | console.log("绘制圆形"); 23 | } 24 | } 25 | 26 | // const shape = new AbstractShape(); 27 | const rect = new Rectangle(); 28 | const circle = new Circle(); 29 | 30 | rect.draw(); 31 | circle.draw(); 32 | -------------------------------------------------------------------------------- /chapter8/abstract_class2.js: -------------------------------------------------------------------------------- 1 | // chapter8/abstract_class2.js 2 | class AbstractShape { 3 | constructor() { 4 | if (new.target === AbstractShape) { 5 | throw "不能直接初始化抽象类"; 6 | } 7 | } 8 | 9 | draw() { 10 | throw "未定义"; 11 | } 12 | } 13 | 14 | class Rectangle extends AbstractShape { 15 | draw() { 16 | console.log("绘制矩形"); 17 | } 18 | } 19 | 20 | class Circle extends AbstractShape { 21 | draw() { 22 | console.log("绘制圆形"); 23 | } 24 | } 25 | 26 | function drawShape(shape) { 27 | shape.draw(); 28 | } 29 | 30 | drawShape(new Rectangle()); 31 | const someObj = { 32 | draw() { 33 | console.log("随意对象..."); 34 | }, 35 | }; 36 | drawShape(someObj); 37 | -------------------------------------------------------------------------------- /chapter8/composition1.js: -------------------------------------------------------------------------------- 1 | // chapter8/composition1.js 2 | class Department { 3 | constructor(name, manager) { 4 | this.name = name; 5 | this.manager = manager; 6 | } 7 | 8 | get info() { 9 | return `部门名称:${this.name},部门经理:${this.manager}`; 10 | } 11 | } 12 | class Employee { 13 | constructor(name, dept) { 14 | this.name = name; 15 | this.dept = dept; 16 | } 17 | 18 | get info() { 19 | return `员工姓名:${this.name}, ${this.dept.info}`; 20 | } 21 | } 22 | 23 | const dept = new Department("信息技术部", "李四"); 24 | const emp = new Employee("张三", dept); 25 | console.log(emp.info); 26 | -------------------------------------------------------------------------------- /chapter8/constructor1.js: -------------------------------------------------------------------------------- 1 | // chapter8/constructor1.js 2 | class Employee { 3 | constructor(name, dept) { 4 | this.name = name; 5 | this.dept = dept; 6 | } 7 | } 8 | 9 | const emp = new Employee("张三", "软件开发部"); 10 | emp.name; // "张三" 11 | emp.dept; // "软件开发部" 12 | -------------------------------------------------------------------------------- /chapter8/inheritance1.js: -------------------------------------------------------------------------------- 1 | // chapter8/inheritance1.js; 2 | class Employee { 3 | constructor(name, dept) { 4 | this.name = name; 5 | this.dept = dept; 6 | } 7 | 8 | signIn() { 9 | console.log("打卡上班"); 10 | } 11 | 12 | askForLeave() { 13 | console.log("请假"); 14 | } 15 | 16 | get info() { 17 | return `员工姓名:${this.name},所在部门:${this.dept}`; 18 | } 19 | set info(value) { 20 | this.name = value.name; 21 | this.dept = value.name; 22 | } 23 | } 24 | 25 | class Manager extends Employee {} 26 | 27 | var mgr = new Manager("李经理", "信息技术部"); 28 | mgr.signIn(); 29 | mgr.askForLeave(); 30 | console.log(mgr.info); 31 | 32 | console.log(mgr instanceof Manager); 33 | console.log(mgr instanceof Employee); 34 | console.log(mgr instanceof Object); 35 | -------------------------------------------------------------------------------- /chapter8/inheritance2.js: -------------------------------------------------------------------------------- 1 | // chapter8/inheritance2.js 2 | class Employee { 3 | constructor(name, dept) { 4 | this.name = name; 5 | this.dept = dept; 6 | } 7 | 8 | signIn() { 9 | console.log("打卡上班"); 10 | } 11 | 12 | askForLeave() { 13 | console.log("请假"); 14 | } 15 | 16 | get info() { 17 | return `员工姓名:${this.name},所在部门:${this.dept}`; 18 | } 19 | set info(value) { 20 | this.name = value.name; 21 | this.dept = value.name; 22 | } 23 | } 24 | 25 | class Manager extends Employee { 26 | signIn() { 27 | console.log("经理打卡上班"); 28 | } 29 | approval(approved) { 30 | console.log(approved ? "审批通过" : "审批不通过"); 31 | } 32 | } 33 | 34 | var mgr = new Manager("李经理", "信息技术部"); 35 | mgr.signIn(); 36 | mgr.approval(true); 37 | -------------------------------------------------------------------------------- /chapter8/inheritance3.js: -------------------------------------------------------------------------------- 1 | // chapter8/inheritance3.js 2 | class Employee { 3 | constructor(name, dept) { 4 | this.name = name; 5 | this.dept = dept; 6 | } 7 | 8 | signIn() { 9 | console.log("打卡上班"); 10 | } 11 | 12 | askForLeave() { 13 | console.log("请假"); 14 | } 15 | 16 | get info() { 17 | return `员工姓名:${this.name},所在部门:${this.dept}`; 18 | } 19 | set info(value) { 20 | this.name = value.name; 21 | this.dept = value.name; 22 | } 23 | } 24 | 25 | class SoftwareEngineer extends Employee { 26 | constructor(name, dept, skill) { 27 | super(name, dept); 28 | this.skill = skill; 29 | } 30 | } 31 | 32 | var se = new SoftwareEngineer("王五", "信息技术部", "JavaScript"); 33 | console.log(se.name, se.dept, se.skill); 34 | -------------------------------------------------------------------------------- /chapter8/inheritance4.js: -------------------------------------------------------------------------------- 1 | // chapter8/inheritance4.js 2 | class Employee { 3 | constructor(name, dept) { 4 | this.name = name; 5 | this.dept = dept; 6 | } 7 | 8 | signIn() { 9 | console.log("打卡上班"); 10 | } 11 | 12 | askForLeave() { 13 | console.log("请假"); 14 | } 15 | 16 | get info() { 17 | return `员工姓名:${this.name},所在部门:${this.dept}`; 18 | } 19 | set info(value) { 20 | this.name = value.name; 21 | this.dept = value.name; 22 | } 23 | } 24 | 25 | class SoftwareEngineer extends Employee { 26 | constructor(name, dept, skill) { 27 | super(name, dept); 28 | this.skill = skill; 29 | } 30 | 31 | signIn() { 32 | super.signIn(); 33 | console.log("软件工程师"); 34 | } 35 | } 36 | 37 | var se = new SoftwareEngineer("王五", "信息技术部", "JavaScript"); 38 | se.signIn(); 39 | -------------------------------------------------------------------------------- /chapter8/methods1.js: -------------------------------------------------------------------------------- 1 | // chapter8/methods1.js 2 | class Employee { 3 | constructor(name, dept) { 4 | this.name = name; 5 | this.dept = dept; 6 | } 7 | 8 | signIn() { 9 | console.log("打卡上班"); 10 | } 11 | 12 | askForLeave() { 13 | console.log("请假"); 14 | } 15 | } 16 | 17 | const emp = new Employee("张三", "软件开发部"); 18 | emp.name; // "张三" 19 | emp.dept; // "软件开发部" 20 | 21 | emp.signIn(); 22 | emp.askForLeave(); 23 | -------------------------------------------------------------------------------- /chapter8/methods2.js: -------------------------------------------------------------------------------- 1 | // chapter8/methods2.js 2 | class Employee { 3 | constructor(name, dept) { 4 | this.name = name; 5 | this.dept = dept; 6 | } 7 | 8 | signIn() { 9 | console.log("打卡上班"); 10 | } 11 | 12 | askForLeave() { 13 | console.log("请假"); 14 | } 15 | 16 | get info() { 17 | return `员工姓名:${this.name},所在部门:${this.dept}`; 18 | } 19 | set info(value) { 20 | this.name = value.name; 21 | this.dept = value.dept; 22 | } 23 | } 24 | 25 | const emp = new Employee("张三", "软件开发部"); 26 | emp.name; // "张三" 27 | emp.dept; // "软件开发部" 28 | 29 | emp.signIn(); 30 | emp.askForLeave(); 31 | 32 | console.log(emp.info); 33 | emp.info = { name: "李四", dept: "软件开发 II 部" }; 34 | console.log(emp.info); 35 | -------------------------------------------------------------------------------- /chapter8/private_fields1.js: -------------------------------------------------------------------------------- 1 | // chapter8/private_fields1.js 2 | class Button { 3 | label = "按钮"; 4 | #html = this.#generateHtml("button"); // 使用私有成员方法生成 html 5 | constructor(type) { 6 | // 如果是链接形式的按钮,使用标签渲染 7 | if (type === "link") { 8 | this.#html = this.#generateHtml("a"); // 使用私有成员方法生成 html 9 | } 10 | } 11 | render() { 12 | console.log(this.#html); // 可以在类中访问私有成员变量,注意变量前的# 13 | } 14 | #generateHtml(tag) { 15 | return `<${tag}>${this.label}`; 16 | } 17 | } 18 | 19 | const btn = new Button(); 20 | btn.render(); // 21 | btn.#generateHtml("button"); 22 | const linkBtn = new Button("link"); 23 | linkBtn.render(); // 按钮 24 | -------------------------------------------------------------------------------- /chapter8/public_fields1.js: -------------------------------------------------------------------------------- 1 | // chapter8/public_fields1.js 2 | class Button { 3 | label = "按钮"; 4 | } 5 | 6 | const btn = new Button(); 7 | console.log(btn.label); 8 | btn.label = "跳转"; 9 | console.log(btn.label); 10 | -------------------------------------------------------------------------------- /chapter8/public_fields2.js: -------------------------------------------------------------------------------- 1 | // chapter8/public_fields2.js 2 | class Button { 3 | label = "按钮"; 4 | html = ``; 5 | constructor(type) { 6 | // 如果是链接形式的按钮,使用标签渲染 7 | if (type === "link") { 8 | this.html = `${this.label}`; // 修改 html 成员变量的值 9 | } 10 | } 11 | } 12 | 13 | const btn = new Button(); 14 | console.log(btn.html); // 15 | const linkBtn = new Button("link"); 16 | console.log(linkBtn.html); // 按钮 17 | -------------------------------------------------------------------------------- /chapter8/static_fields1.js: -------------------------------------------------------------------------------- 1 | // chapter8/static_fields1.js 2 | class Page { 3 | static viewCount = 0; 4 | 5 | static increase() { 6 | this.viewCount++; // 或 Page.viewCount++; 7 | } 8 | } 9 | 10 | Page.increase(); 11 | Page.increase(); 12 | console.log(Page.viewCount); 13 | -------------------------------------------------------------------------------- /chapter8/static_fields2.js: -------------------------------------------------------------------------------- 1 | // chapter8/static_fields2.js 2 | class Page { 3 | static viewCount = 0; 4 | 5 | static increase() { 6 | Page.viewCount++; 7 | } 8 | } 9 | 10 | class SubPage extends Page {} 11 | 12 | Page.increase(); 13 | Page.increase(); 14 | console.log(Page.viewCount); 15 | console.log(SubPage.viewCount); 16 | -------------------------------------------------------------------------------- /chapter8/static_fields3.js: -------------------------------------------------------------------------------- 1 | // chapter8/static_fields3.js 2 | class Page { 3 | static #viewCount = 0; 4 | 5 | static increase() { 6 | this.#viewCount++; 7 | } 8 | } 9 | 10 | class SubPage extends Page {} 11 | 12 | SubPage.increase(); 13 | -------------------------------------------------------------------------------- /chapter8/static_fields4.js: -------------------------------------------------------------------------------- 1 | // chapter8/static_fields4.js 2 | class Page { 3 | static #viewCount = 0; 4 | 5 | static increase() { 6 | Page.#viewCount++; 7 | } 8 | 9 | static getViewCount() { 10 | return Page.#viewCount; 11 | } 12 | } 13 | 14 | class SubPage extends Page {} 15 | 16 | SubPage.increase(); 17 | console.log(SubPage.getViewCount()); 18 | -------------------------------------------------------------------------------- /chapter9/regexp1.js: -------------------------------------------------------------------------------- 1 | // chapter9/regexp1.js 2 | function replacer(match, g1, g2, pos, str, group) { 3 | console.log(match, g1, g2, pos, str, group); 4 | return match.toUpperCase(); 5 | } 6 | 7 | let str = "java and javascript".replace(/(ja)va(\s+|\w+)/g, replacer); 8 | console.log(str); 9 | -------------------------------------------------------------------------------- /chapter9/regexp2.js: -------------------------------------------------------------------------------- 1 | // chapter9/regexp2.js 2 | let re = new RegExp("abc", "g"); 3 | re.lastIndex; // 0 4 | console.log(re.test("abcabc")); // true 5 | console.log(re.lastIndex); // 3 6 | console.log(re.test("abcabc")); // true 7 | console.log(re.lastIndex); // 6 8 | console.log(re.test("abcabc")); // false 9 | -------------------------------------------------------------------------------- /chapter9/regexp3.js: -------------------------------------------------------------------------------- 1 | // chapter9/regexp3.js 2 | let re = new RegExp("(abc)?", "g"); 3 | console.log(re.lastIndex); // 0 4 | console.log(re.test("abcabcab")); // true 5 | console.log(re.lastIndex); // 3 6 | console.log(re.test("abcabcab")); // true 7 | console.log(re.lastIndex); // 6 8 | console.log(re.test("abcabcab")); // true 9 | console.log(re.lastIndex); // 6 10 | console.log(re.test("abcabcab")); // true 11 | console.log(re.lastIndex); // 6 12 | console.log(re.test("abcabcab")); // true 13 | console.log(re.lastIndex); // 6 14 | console.log(re.test("abcabcab")); // true 15 | console.log(re.lastIndex); // 6 16 | -------------------------------------------------------------------------------- /chapter9/regexp4.js: -------------------------------------------------------------------------------- 1 | // chapter9/regexp4.js 2 | let re = new RegExp("abc", "g"); 3 | "abcabc".match(re); // ["abc", "abc"] 4 | re.lastIndex; // 0 5 | re.exec("abcabc"); // ["abc", index: 0, input: "abcabc", groups: undefined] 6 | re.lastIndex; // 3 7 | re.exec("abcabc"); // ["abc", index: 3, input: "abcabc", groups: undefined] 8 | re.lastIndex; // 6 9 | -------------------------------------------------------------------------------- /chapter9/string1.js: -------------------------------------------------------------------------------- 1 | // chapter9/string1.js 2 | let str = "这是一个字符串"; 3 | console.log(str.substring(4, 1)); // 结束索引大于起始索引 4 | console.log(str.substring(2, 2)); // 结束索引等于起始索引 5 | console.log(str.substring(4, 12)); // 索引大于 length 6 | console.log(str.substring(-2)); // 索引为负数 7 | console.log(str.substring(4, NaN)); // 索引为 NaN 8 | -------------------------------------------------------------------------------- /chapter9/string2.js: -------------------------------------------------------------------------------- 1 | // chapter9/string2.js 2 | let str = "这是一个字符串"; 3 | console.log(str.slice(1, 4)); // 正常情况 4 | console.log(str.slice(4, 1)); // 结束索引大于起始索引 5 | console.log(str.slice(-2)); // 索引为负数 6 | console.log(str.slice(4, NaN)); // 结束索引为 NaN 7 | -------------------------------------------------------------------------------- /chapter9/string3.js: -------------------------------------------------------------------------------- 1 | // chapter9/string3.js 2 | let str = "hello world"; 3 | let search = "o"; 4 | let result = []; 5 | let index = str.indexOf(search); 6 | while (index > -1) { 7 | result.push(index); 8 | index = str.indexOf(search, index + 1); 9 | } 10 | 11 | console.log(result); // [ 4, 7 ] 12 | -------------------------------------------------------------------------------- /chapter9/string4.js: -------------------------------------------------------------------------------- 1 | // chapter9/string4.js 2 | let tags = "前端, JavaScript, React, Vue, Angular"; 3 | console.log(tags.split(", ")); // [ '前端', 'JavaScript', 'React', 'Vue', 'Angular' ] 4 | console.log(tags.split(", ", 2)); // [ '前端', 'JavaScript' ] 5 | 6 | let lines = "第一行\n\r第二行\n\r第三行"; 7 | console.log(lines.split("\n\r")); // [ '第一行', '第二行', '第三行' ] 8 | 9 | let str = "hello"; 10 | console.log(str.split()); // [ 'hello' ] 11 | console.log(str.split("")); // [ 'h', 'e', 'l', 'l', 'o' ] 12 | console.log("😉".split("")); // [ '�', '�' ] 13 | -------------------------------------------------------------------------------- /chapter9/tagged_templates1.js: -------------------------------------------------------------------------------- 1 | // chapter9/tagged_templates1.js 2 | function reorder(strings, ...exps) { 3 | console.log(strings); 4 | return `${exps[1]}:${exps[0]} 篇文章`; 5 | } 6 | 7 | let tag = "JS"; 8 | let res = reorder`共有 ${10} 篇文章在 ${tag} 标签下`; 9 | console.log(res); 10 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zxuqian/javascript-book-examples/cada0dc480fbd62fcdabfe824027c7f8486a0574/index.js --------------------------------------------------------------------------------