-
Notifications
You must be signed in to change notification settings - Fork 30
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
export name #7
Comments
It could be improved, any suggestion? :p As far as I know, the export name on AMD or CommonJS depends on the user's environment. On AMD, it depends how users configure paths. On CommonJS, it depends how users name directories. This project has been registered under the My node.js example suggests using My require.js example suggests using Should we suggest users to define path I agree the consistency among the export names could be improved, I've caught myself with the same concern once, looking for ideas. |
I guess the |
Do you mean
Cldr is a class. It's not a function. On README, note the difference between the Cldr.s and cldr.. The former are class methods, the latter are instance methods. |
Yeah, my bad. It is a constructor. Most projects that I've worked with try to hide the constructor and instead provide a factory function. It is a simpler interface (users don't have to remember when to do new and when not), and you can provide multiple constructors (factories) instead of relying on the single one exported by your module. You can also change the implementation to use another object pattern (closures for example). About the |
No problem. About the factory function, we can discuss that in another issue if that turns out to be a problem. About the name, I am not sure what other name to use. But, I think for now (beginning phase), let's make sure we build a great product, and we keep our goal: simple layer to facilitate I18n softwares to access and use the official CLDR JSON data. If our name becomes a problem, we can always fix that. I still think consistency is important, so I'm still open to suggestions on that regard. Thanks |
Renamed project from |
The above commit actually didn't help consistency on anything compared to what we had before... In order to use I think this would bring more complexity for cldr.js users using require.js compared to what we had before: require.config({
paths: {
"cldr": "bower_components/cldrjs/dist/cldr"
}
});
require( [ "cldr", "cldr/supplemental", "cldr/unresolved" ], function( Cldr ) {
...
}); So, I won't make any changes on that regard at this moment. |
I'm closing this for lack of activity. Feedbacks are still welcome. |
Here's a suggestion: npm/bower package name: JavaScript identifier: AMD: Inspired by names used in messageformat.js |
@ichernev what do you think about my suggestion in my previous comment? |
I personally find the concat same case version hard to read. But if that would make it more uniform across platforms its fine. |
I like the idea of making the distinction between both cldrjs (the traverser) and cldr-data more explicit. Maybe |
I'm okay with |
Alert dependents of this change as possible:
|
It looks like the export name under AMD is
cldr
, under CommonJS iscldr.js
and the global variable is namedCldr
. Can it be a bit more consistent?The text was updated successfully, but these errors were encountered: