jeudi 5 février 2015

Should you use named functions when developing a JavaScript library?


For example:



module.exports = {
myLibraryFunction: function myLibraryFunction() {
...
}
}


The disadvantage is obvious. It's not very DRY, which means it can easily become out-of-sync if you're not careful. It also makes your code a little more verbose.


So what are the advantages? Is the tradeoff worth it?





Aucun commentaire:

Enregistrer un commentaire