gvwilson / sdxjs

Software Design by Example with JavaScript
Other
49 stars 12 forks source link

Outdated examples using glob in Chapter 2 #49

Open vramana opened 4 months ago

vramana commented 4 months ago

Current version of glob doesn't support callback API. May be the chapter needs to be updated or recommend an older version.

https://www.npmjs.com/package/glob

gvwilson commented 4 months ago

thanks for the pointer - a pull request would be great (and all contributors are acknowledged).

perterHUAN commented 3 months ago

We need to understand all three layers in order to debug things when they go wrong, so this chapter explores callbacks, while Chapter 3 shows how promises and async/await work.

  • At the beginning of Chapter 2, it's mentioned that we initially explore callbacks in this chapter, while Chapter 3 delves into how async/await operates.
  • The newer version of glob returns a Promise, allowing data or error information to be accessed via the then method. However, changing to an example using the updated glob might be premature, as Promises are discussed in Chapter 3, whereas this chapter primarily focuses on callbacks.
  • It would be appropriate to maintain the current code examples but clarify their version, so readers can follow along without encountering errors.