chainyjs / chainy

The chainy core + autoloader plugin
https://github.com/chainyjs/chainy/wiki
Other
79 stars 4 forks source link

Allow capitalised names for extensions #11

Open balupton opened 10 years ago

balupton commented 10 years ago

Not sure how we could do this.

balupton commented 10 years ago

Actually, considering #14 we will need to support more than just capitalised names. I'm considering the following convention:

NAME => [NAME, ALIASES...]
lodash.flatten => [lodash.flatten, lodashflatten, lodashFlatten, flatten]
query-engine => [query-engine, queryEngine, queryengine]

Problem we will need to avoid is duplicates and overrides. Not sure how to handle this. Options are:

  1. Name is the most simple reduced name, instead of the required package name
  2. Or, we track all aliases, and warn on conflicts, a setting that can be turned off but on by default

This would allow us to do things like:

require('chainy').create().require('lodash.flatten set log')
    .set([1,[2,3],4]).flatten().log() // [1,2,3,4]

Very very cool.