Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why do a lowerCase on all function names #10

Open
monemihir opened this issue Jul 12, 2017 · 4 comments
Open

why do a lowerCase on all function names #10

monemihir opened this issue Jul 12, 2017 · 4 comments

Comments

@monemihir
Copy link
Contributor

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?

@Neamar
Copy link
Owner

Neamar commented Jul 12, 2017

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!

@jfyles
Copy link

jfyles commented Aug 17, 2017

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!

@Neamar
Copy link
Owner

Neamar commented Aug 17, 2017

@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?

@jfyles
Copy link

jfyles commented Aug 17, 2017

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants