you cant rely on the properties order in a object. standard says it
undefined. if you rely on order use array as Martin said.
Am Freitag, 10. August 2012 02:13:07 UTC+2 schrieb Alan Gutierrez:
>
> 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" } };
>
> 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