Last active
September 19, 2023 02:06
-
-
Save plskz/5a37b1c892e955b8b61f562ac1041452 to your computer and use it in GitHub Desktop.
FrontendMasters - get course contents then paste it to logseq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jsonData from './developer-productivity.json' | |
| const data = jsonData as Welcome; | |
| export interface Welcome { | |
| course: string; | |
| url: string; | |
| chapters: Chapter[]; | |
| } | |
| export interface Chapter { | |
| chapter: string; | |
| lessons: Lesson[]; | |
| } | |
| export interface Lesson { | |
| lesson: string; | |
| url: string; | |
| items?: Item[]; | |
| } | |
| export interface Item { | |
| url: string; | |
| type: Type; | |
| timestamp: string; | |
| body: string; | |
| } | |
| export enum Type { | |
| Annotation = "annotation", | |
| Note = "note", | |
| } | |
| console.log('- ## Contents'); | |
| for(const chapter of data.chapters) { | |
| console.log(`\t- ### ${chapter.chapter}`); | |
| for (const lesson of chapter.lessons) { | |
| console.log(`\t\t- ${lesson.lesson}`); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run
tsconfig.json
{ "compilerOptions": { "resolveJsonModule": true, "target": "es2016", "module": "commonjs", "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, } }ts-node index.ts > output.txt