fengxinming / vite-plugins

Some custom plugins for vitejs.
https://fengxinming.github.io/vite-plugins/
MIT License
70 stars 6 forks source link

Use async/await when handling promises #17

Closed tenkiller closed 1 year ago

tenkiller commented 1 year ago

Using the async and await syntax when handling native Promises is standard, and leads to more readable and understandable code. Additionally, I moved the copied = true statement so it only executes on success rather than on success or failure.

Without a testing framework, however, this implementation is difficult to test. I don't want to be presumptuous or rude, so, I didn't do that for you. But, I would highly suggest adding tests.