| 1 | import flights from "./data.json" |
| 2 | import { pb } |
| 3 | |
| 4 | /** |
| 5 | * Given a string, capitalize the first letter and return the result. |
| 6 | * If the string is empty, return an empty string. |
| 7 | * @param |
| 8 | * @returns The capitalized string. |
| 9 | */ |
| 10 | function capitalize(text: |
| 11 | if (!text) |
| 12 | return text[0] |
| 13 | } |
| 14 | |
| 15 | for (const flight |
| 16 | const name = |
| 17 | const [iata, |
| 18 | |
| 19 | await pb.collection |
| 20 | name: capitalize(name |
| 21 | iata, |
| 22 | icao |
| 23 | }, { requestKey: null |
| 24 | } |
| 25 | console.log(flights. |