diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000..1297929d8e Binary files /dev/null and b/.DS_Store differ diff --git a/01-pure-react/.DS_Store b/01-pure-react/.DS_Store new file mode 100644 index 0000000000..960910d256 Binary files /dev/null and b/01-pure-react/.DS_Store differ diff --git a/01-pure-react/final/index.html b/01-pure-react/final/index.html index 02bb1ac555..548627af0b 100644 --- a/01-pure-react/final/index.html +++ b/01-pure-react/final/index.html @@ -2,37 +2,25 @@ - Hello React!
- - - - + + diff --git a/02-JS-review/.DS_Store b/02-JS-review/.DS_Store new file mode 100644 index 0000000000..6fb5938c72 Binary files /dev/null and b/02-JS-review/.DS_Store differ diff --git a/02-JS-review/final/script.js b/02-JS-review/final/script.js index 25b1986502..2b2ea9ad17 100644 --- a/02-JS-review/final/script.js +++ b/02-JS-review/final/script.js @@ -1,23 +1,16 @@ const data = [ { id: 1, - title: "The Lord of the Rings", - publicationDate: "1954-07-29", - author: "J. R. R. Tolkien", - genres: [ - "fantasy", - "high-fantasy", - "adventure", - "fiction", - "novels", - "literature", - ], + title: 'The Lord of the Rings', + publicationDate: '1954-07-29', + author: 'J. R. R. Tolkien', + genres: ['fantasy', 'high-fantasy', 'adventure', 'fiction', 'novels', 'literature'], hasMovieAdaptation: true, pages: 1216, translations: { - spanish: "El señor de los anillos", - chinese: "魔戒", - french: "Le Seigneur des anneaux", + spanish: 'El señor de los anillos', + chinese: '魔戒', + french: 'Le Seigneur des anneaux', }, reviews: { goodreads: { @@ -34,16 +27,10 @@ const data = [ }, { id: 2, - title: "The Cyberiad", - publicationDate: "1965-01-01", - author: "Stanislaw Lem", - genres: [ - "science fiction", - "humor", - "speculative fiction", - "short stories", - "fantasy", - ], + title: 'The Cyberiad', + publicationDate: '1965-01-01', + author: 'Stanislaw Lem', + genres: ['science fiction', 'humor', 'speculative fiction', 'short stories', 'fantasy'], hasMovieAdaptation: false, pages: 295, translations: {}, @@ -62,14 +49,14 @@ const data = [ }, { id: 3, - title: "Dune", - publicationDate: "1965-01-01", - author: "Frank Herbert", - genres: ["science fiction", "novel", "adventure"], + title: 'Dune', + publicationDate: '1965-01-01', + author: 'Frank Herbert', + genres: ['science fiction', 'novel', 'adventure'], hasMovieAdaptation: false, pages: 658, translations: { - spanish: "", + spanish: '', }, reviews: { goodreads: { @@ -82,16 +69,16 @@ const data = [ { id: 4, title: "Harry Potter and the Philosopher's Stone", - publicationDate: "1997-06-26", - author: "J. K. Rowling", - genres: ["fantasy", "adventure"], + publicationDate: '1997-06-26', + author: 'J. K. Rowling', + genres: ['fantasy', 'adventure'], hasMovieAdaptation: true, pages: 223, translations: { - spanish: "Harry Potter y la piedra filosofal", - korean: "해리 포터와 마법사의 돌", - bengali: "হ্যারি পটার এন্ড দ্য ফিলোসফার্স স্টোন", - portuguese: "Harry Potter e a Pedra Filosofal", + spanish: 'Harry Potter y la piedra filosofal', + korean: '해리 포터와 마법사의 돌', + bengali: 'হ্যারি পটার এন্ড দ্য ফিলোসফার্স স্টোন', + portuguese: 'Harry Potter e a Pedra Filosofal', }, reviews: { goodreads: { @@ -108,17 +95,17 @@ const data = [ }, { id: 5, - title: "A Game of Thrones", - publicationDate: "1996-08-01", - author: "George R. R. Martin", - genres: ["fantasy", "high-fantasy", "novel", "fantasy fiction"], + title: 'A Game of Thrones', + publicationDate: '1996-08-01', + author: 'George R. R. Martin', + genres: ['fantasy', 'high-fantasy', 'novel', 'fantasy fiction'], hasMovieAdaptation: true, pages: 835, translations: { - korean: "왕좌의 게임", - polish: "Gra o tron", - portuguese: "A Guerra dos Tronos", - spanish: "Juego de tronos", + korean: '왕좌의 게임', + polish: 'Gra o tron', + portuguese: 'A Guerra dos Tronos', + spanish: 'Juego de tronos', }, reviews: { goodreads: { @@ -140,20 +127,18 @@ function getBooks() { } function getBook(id) { - return data.find((d) => d.id === id); + return data.find(d => d.id === id); } // Destructuring -/* -const book = getBook(3); +const book = getBook(1); book; // const title = book.title; // const author = book.author; -const { title, author, pages, publicationDate, genres, hasMovieAdaptation } = - book; +const { title, author, pages, publicationDate, genres, hasMovieAdaptation } = book; console.log(author, title, genres); @@ -163,13 +148,13 @@ console.log(author, title, genres); const [primaryGenre, secondaryGenre, ...otherGenres] = genres; console.log(primaryGenre, secondaryGenre, otherGenres); -const newGenres = ["epic fantasy", ...genres]; +const newGenres = ['epic fantasy', ...genres]; newGenres; const updatedBook = { ...book, // Adding a new property - moviePublicationDate: "2001-12-19", + moviePublicationDate: '2001-12-19', // Overwriting an existing property pages: 1210, @@ -180,40 +165,40 @@ updatedBook; // return str.split("-")[0]; // } -const getYear = (str) => str.split("-")[0]; +const getYear = str => str.split('-')[0]; console.log(getYear(publicationDate)); const summary = `${title}, a ${pages}-page long book, was written by ${author} and published in ${getYear( publicationDate -)}. The book has ${hasMovieAdaptation ? "" : "not"} been adapted as a movie`; +)}. The book has ${hasMovieAdaptation ? '' : 'not'} been adapted as a movie`; summary; -const pagesRange = pages > 1000 ? "over a thousand" : "less than 1000"; +const pagesRange = pages > 1000 ? 'over a thousand' : 'less than 1000'; pagesRange; console.log(`The book has ${pagesRange} pages`); -console.log(true && "Some string"); -console.log(false && "Some string"); -console.log(hasMovieAdaptation && "This book has a movie"); +console.log(true && 'Some string'); +console.log(false && 'Some string'); +console.log(hasMovieAdaptation && 'This book has a movie'); // falsy: 0, '', null, undefined -console.log("jonas" && "Some string"); -console.log(0 && "Some string"); +console.log('jonas' && 'Some string'); +console.log(0 && 'Some string'); -console.log(true || "Some string"); -console.log(false || "Some string"); +console.log(true || 'Some string'); +console.log(false || 'Some string'); console.log(book.translations.spanish); -const spanishTranslation = book.translations.spanish || "NOT TRANSLATED"; +const spanishTranslation = book.translations.spanish || 'NOT TRANSLATED'; spanishTranslation; -// console.log(book.reviews.librarything.reviewsCount); -// const countWrong = book.reviews.librarything.reviewsCount || "no data"; -// countWrong; +console.log(book.reviews.librarything.reviewsCount); +const countWrong = book.reviews.librarything.reviewsCount || 'no data'; +countWrong; -// const count = book.reviews.librarything.reviewsCount ?? "no data"; -// count; +const count = book.reviews.librarything.reviewsCount ?? 'no data'; +count; function getTotalReviewCount(book) { const goodreads = book.reviews?.goodreads?.reviewsCount; @@ -223,7 +208,6 @@ function getTotalReviewCount(book) { } console.log(getTotalReviewCount(book)); -*/ /* function getTotalReviewCount(book) { @@ -297,7 +281,7 @@ booksAfterUpdate; // console.log("jonas"); async function getTodos() { - const res = await fetch("https://jsonplaceholder.typicode.com/todos"); + const res = await fetch('https://jsonplaceholder.typicode.com/todos'); const data = await res.json(); console.log(data); @@ -307,4 +291,4 @@ async function getTodos() { const todos = getTodos(); console.log(todos); -console.log("jonas"); +console.log('jonas'); diff --git a/03-pizza-menu/.DS_Store b/03-pizza-menu/.DS_Store new file mode 100644 index 0000000000..4a692c876d Binary files /dev/null and b/03-pizza-menu/.DS_Store differ diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json new file mode 100644 index 0000000000..cfefc0a601 --- /dev/null +++ b/node_modules/.package-lock.json @@ -0,0 +1,44 @@ +{ + "name": "ultimate-react-course", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/@babel/helper-plugin-utils": { + "version": "7.24.8", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.8.tgz", + "integrity": "sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-nullish-coalescing-operator": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-nullish-coalescing-operator/-/plugin-transform-nullish-coalescing-operator-7.24.7.tgz", + "integrity": "sha512-Ts7xQVk1OEocqzm8rHMXHlxvsfZ0cEF2yomUqpKENHWMF4zKk175Y4q8H5knJes6PgYad50uuRmt3UJuhBw8pQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + } + } +} diff --git a/node_modules/@babel/helper-plugin-utils/LICENSE b/node_modules/@babel/helper-plugin-utils/LICENSE new file mode 100644 index 0000000000..f31575ec77 --- /dev/null +++ b/node_modules/@babel/helper-plugin-utils/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2014-present Sebastian McKenzie and other contributors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/@babel/helper-plugin-utils/README.md b/node_modules/@babel/helper-plugin-utils/README.md new file mode 100644 index 0000000000..a99070f3e5 --- /dev/null +++ b/node_modules/@babel/helper-plugin-utils/README.md @@ -0,0 +1,19 @@ +# @babel/helper-plugin-utils + +> General utilities for plugins to use + +See our website [@babel/helper-plugin-utils](https://babeljs.io/docs/babel-helper-plugin-utils) for more information. + +## Install + +Using npm: + +```sh +npm install --save @babel/helper-plugin-utils +``` + +or using yarn: + +```sh +yarn add @babel/helper-plugin-utils +``` diff --git a/node_modules/@babel/helper-plugin-utils/lib/index.js b/node_modules/@babel/helper-plugin-utils/lib/index.js new file mode 100644 index 0000000000..b8b736624f --- /dev/null +++ b/node_modules/@babel/helper-plugin-utils/lib/index.js @@ -0,0 +1,77 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.declare = declare; +exports.declarePreset = void 0; +const apiPolyfills = { + assertVersion: api => range => { + throwVersionError(range, api.version); + } +}; +{ + Object.assign(apiPolyfills, { + targets: () => () => { + return {}; + }, + assumption: () => () => { + return undefined; + } + }); +} +function declare(builder) { + return (api, options, dirname) => { + var _clonedApi2; + let clonedApi; + for (const name of Object.keys(apiPolyfills)) { + var _clonedApi; + if (api[name]) continue; + (_clonedApi = clonedApi) != null ? _clonedApi : clonedApi = copyApiObject(api); + clonedApi[name] = apiPolyfills[name](clonedApi); + } + return builder((_clonedApi2 = clonedApi) != null ? _clonedApi2 : api, options || {}, dirname); + }; +} +const declarePreset = exports.declarePreset = declare; +function copyApiObject(api) { + let proto = null; + if (typeof api.version === "string" && /^7\./.test(api.version)) { + proto = Object.getPrototypeOf(api); + if (proto && (!hasOwnProperty.call(proto, "version") || !hasOwnProperty.call(proto, "transform") || !hasOwnProperty.call(proto, "template") || !hasOwnProperty.call(proto, "types"))) { + proto = null; + } + } + return Object.assign({}, proto, api); +} +function throwVersionError(range, version) { + if (typeof range === "number") { + if (!Number.isInteger(range)) { + throw new Error("Expected string or integer value."); + } + range = `^${range}.0.0-0`; + } + if (typeof range !== "string") { + throw new Error("Expected string or integer value."); + } + const limit = Error.stackTraceLimit; + if (typeof limit === "number" && limit < 25) { + Error.stackTraceLimit = 25; + } + let err; + if (version.slice(0, 2) === "7.") { + err = new Error(`Requires Babel "^7.0.0-beta.41", but was loaded with "${version}". ` + `You'll need to update your @babel/core version.`); + } else { + err = new Error(`Requires Babel "${range}", but was loaded with "${version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`); + } + if (typeof limit === "number") { + Error.stackTraceLimit = limit; + } + throw Object.assign(err, { + code: "BABEL_VERSION_UNSUPPORTED", + version, + range + }); +} + +//# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/helper-plugin-utils/lib/index.js.map b/node_modules/@babel/helper-plugin-utils/lib/index.js.map new file mode 100644 index 0000000000..9eb14a4cf6 --- /dev/null +++ b/node_modules/@babel/helper-plugin-utils/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"names":["apiPolyfills","assertVersion","api","range","throwVersionError","version","Object","assign","targets","assumption","undefined","declare","builder","options","dirname","_clonedApi2","clonedApi","name","keys","_clonedApi","copyApiObject","declarePreset","exports","proto","test","getPrototypeOf","hasOwnProperty","call","Number","isInteger","Error","limit","stackTraceLimit","err","slice","code"],"sources":["../src/index.ts"],"sourcesContent":["import type {\n PluginAPI,\n PluginObject,\n PluginPass,\n PresetAPI,\n PresetObject,\n} from \"@babel/core\";\n\ntype APIPolyfillFactory = (\n api: PluginAPI,\n) => PluginAPI[T];\n\ntype APIPolyfills = {\n assertVersion: APIPolyfillFactory<\"assertVersion\">;\n};\n\nconst apiPolyfills: APIPolyfills = {\n // Not supported by Babel 7 and early versions of Babel 7 beta.\n // It's important that this is polyfilled for older Babel versions\n // since it's needed to report the version mismatch.\n assertVersion: (api: PluginAPI) => (range: number | string) => {\n throwVersionError(range, api.version);\n },\n};\nif (!process.env.BABEL_8_BREAKING) {\n Object.assign(apiPolyfills, {\n // This is supported starting from Babel 7.13\n targets: () => () => {\n return {};\n },\n // This is supported starting from Babel 7.13\n assumption: () => () => {\n return undefined;\n },\n });\n}\n\nexport function declare(\n builder: (\n api: PluginAPI,\n options: Option,\n dirname: string,\n ) => PluginObject,\n): (\n api: PluginAPI,\n options: Option,\n dirname: string,\n) => PluginObject {\n return (api, options: Option, dirname: string) => {\n let clonedApi: PluginAPI;\n\n for (const name of Object.keys(\n apiPolyfills,\n ) as (keyof typeof apiPolyfills)[]) {\n if (api[name]) continue;\n\n clonedApi ??= copyApiObject(api);\n clonedApi[name] = apiPolyfills[name](clonedApi);\n }\n\n // @ts-expect-error options || {} may not be assigned to Options\n return builder(clonedApi ?? api, options || {}, dirname);\n };\n}\n\nexport const declarePreset = declare as