auto-load
auto-load copied to clipboard
why do a lowerCase on all function names
Hi,
Why do you do a lowerCase on all file names?
I want the function names/exports to be added as they are. I can understand removing of dashes and dots but why convert the case as well?
Acc to your logic: MyFunction.js => myfunction myFunction.js => myfunction
But I want them to stay as they are i.e MyFunction.js => MyFunction myFunction.js => myFunction
I don't think there should be a blanket lowercase conversion.
Are you able to put in a fix and release?
Hi,
You're right, this shouldn't happen.
That's the line that should be modified: https://github.com/Neamar/auto-load/blob/master/lib/index.js#L18
Can you contribute a PR? If yes, I can merge and publish.
Thanks!
Hi there! I came to mention a very similar thing. Ideally, the file names in memory and the names on disk should be the same. If we're going to be camel-casing the names, could it throw some type of warning or error so that the developer knows what it's doing and can change the name on disk to match if they want consistency? I just debugged someone else's code for 2 hours to figure out where a certain index was getting its name, only to find that this library replaces hyphens with camel casing!
@jfyles that's not ideal, true. But some OS don't respect casing (Windows :), and just relying on the file name could lead to surprising errors on multiple environments.
The convention within the node.js community, as far as I was able to see, was to use the hyphens as a separator within file name, and camelCase for variables. Throwing an error might be even more surprising though, don't you think?
I feel like ideally, there'd be a warning-level debug statement somewhere, but not sure the best way to do that. I do think that silently changing the string could be cause for concern though!