sdxjs
sdxjs copied to clipboard
Outdated examples using glob in Chapter 2
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
thanks for the pointer - a pull request would be great (and all contributors are acknowledged).
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.
Glob 8.1.0 (already deprecated) is the last version of glob which work with callback functions, working with this version we can replicate the examples.