On Thu, Aug 9, 2012 at 5:13 PM, Alan Gutierrez <[email protected]> wrote:
> Have you ever written Node.js code that counts on the implementation specific
> Object behavior that mantains the insertion order of properties?
>
> It could be useful in configuration, for example, to specify fallbacks if the
> first choice isn't available.
>
> var conf = { database: { pg: "psql://localhost/database"
> , mysql: "mysql://localhost/database" } };
I'm probably missing something in what you're trying to achieve, but
at least in this case, why not just use an array?
var conf = {
database: [
{ id: "pg", url: "psql://localhost/database" },
{ id: "mysql", url: "mysql://localhost/database" }
]
};
--
Martin Cooper
> for (var type in conf.database) {
> try {
> useDatabase(require(type), conf.database[type]);
> } catch (e) {
> if (e.code != 'MODULE_NOT_FOUND') throw e;
> }
> }
>
> Great idea or *Greatest* idea?
>
> Possibly related: http://code.google.com/p/v8/issues/detail?id=164
>
> --
> Alan Gutierrez - http://twitter.com/bigeasy - http://github.com/bigeasy
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en