https://github.com/gagle/node-seraphim

*Why?*

nconf cons:
- Single instance: third-party modules cannot use it (shouldn't)
- It reads the entire process.env object: it pollutes the object with keys 
that you don't need.
- It forces you to use the "optimist" module to parse the cli options.
- Cannot relocate the argv options, they are always in the first deep level.
- It reads the files synchronously.
- Can only parse .json files.
- Unmaintained.

seraphim pros:
- Multiple instances.
- process.env is not read, it depends on the user.
- The cli options are not read, it depends on the user, so you can use any 
cli parser.
- It reads the files asynchronously.
- Can parse any extension.
- Incredible awesome api and easy to use.

*Example*

https://github.com/gagle/node-seraphim/blob/master/t.js

"use strict";

var seraphim = require ("./lib");
var properties = require ("properties");
var argv = require ("argp")
        .allowUndefinedArguments ()
        .allowUndefinedOptions ()
        .body ().help ()
        .argv ();

var optionsProperties = {
    path: true,
    namespaces: true
};
        
var vault = seraphim.createVault ();
vault.extension (".properties", function (p, cb){
    properties.parse (p, optionsProperties, cb)
});

vault.on ("error", function (error){
    console.log (error);
});

vault.on ("end", function (){
    console.log (this.get ());
});
        
vault
        .use ({ a: { b: 1 } })
        .use (function (cb){
            process.nextTick (function (){
                cb (null, { a: { b: 2 } });
            });
        })
        .use (function (){
            return { a: { b: 3 } };
        })
        .use ("a.json")
        .use ("b.properties")
        .use (function (){
            var a = vault.get ("a");
            a.b = argv.b !== undefined ? argv.b : a.b;
            a.c = argv.c !== undefined ? argv.c : a.c;
        });

/*
//a.json
{
    "a": {
        "c": 1
    }
}

//b.properties
a.c 2

$ node t.js
{ a: { b: 3, c: 2 } }

node t.js --b 0 --c 3
{ a: { b: 0, c: 3 } }

$ node t.js -h
Usage: t [options]

    -h, --help                  Display this help message and exit
*/

*Whould you buy it?*

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

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to