/*
 * Load cJSON files recursively.
 */

var cjson = require('cjson');

function load(filename) {
    var base = cjson.load(filename);

    if ('#include' in base) {
        base = cjson.extend(true, base, load(base['#include']));
        delete base['#include'];
    }

    return base;
}

module.exports = load;

/*
 * Load cJSON files recursively.
 */

var cjson = require('cjson');

function load(filename) {
    var base = cjson.load(filename),
        fullname = path.normalize(filename),
        dirname = path.dirname(fullname);

    if ('#include' in base) {
        base = cjson.extend(true, base, load(path.resolve(dirname, base['#include'])));
        delete base['#include'];
    }

    return base;
}

module.exports = load;

Implement relative resolve of #include's.