You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/07/17 05:12:13 UTC
[GitHub] [cordova-android] brodybits opened a new issue #786: Improve coding
style (general)
brodybits opened a new issue #786: Improve coding style (general)
URL: https://github.com/apache/cordova-android/issues/786
Some ideas that I raised in review of PR #764, some of which may apply to other Cordova packages:
- use JavaScript array methods such as `forEach`, `map`, and `reduce` to get rid of for loops
- in case of JavaScript objects, use `keys` method to get the array of keys then use array methods to get rid of for loops
- use `const` (first choice) or `let` (second choice) instead of `var`
- use ternaries to get rid of if blocks
- use nested ternaries to get rid of multiple if blocks (possibly controversial)
- use utility packages such as [`recursive-readdir-sync`](https://www.npmjs.com/package/recursive-readdir-sync) whenever possible instead of `shelljs` and to reduce the amount of “fs*” code we have to maintain
I am raising this issue before it gets forgotten. Maybe we should transfer or write this issue in <https://github.com/apache/cordova/issues> for larger discussion and consideration.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org