lib/DefaultDataHandler.js
function getHandler(app, schema, data) {
    function handleSave(err, results, next) {
        if (!err) {
            delete DependenciesMap[schema];
            SavedSchemas.push(schema);
            _l('schema saved: ' + schema);
        }
        next(err, results);
    }

    // Default handler function
    var ret = function (next) {
        data = _.isObject(data) ? _.values(data) : data;
        DBActions.getSimpleInstance(app, schema).multipleSave(data, function (err, results) {
            handleSave(err, results, next);
        });
    };

    // Data handler provided in plugin
    var ret1 = SchemaDataHandler[schema] && function (next) {
        SchemaDataHandler[schema](app, data)(function (err, results) {
            handleSave(err, results, next);
        });
    };
    return ret1 || ret;
}
function getHandler(app, schema, data) {
    function handleSave(err, results, next) {
        if (!err) {
            delete DependenciesMap[schema];
            SavedSchemas.push(schema);
            _l('schema saved: ' + schema);
        }
        next(err, results);
    }

    // Default handler function
    var ret = function (next) {
        data = _.isObject(data) ? _.values(data) : data;
        DBActions.getSimpleInstance(app, schema).multipleSave(data, function (err, results) {
            handleSave(err, results, next);
        });
    };

    // Data handler provided in plugin
    var ret1 = SchemaDataHandler[schema] && function (next) {
        SchemaDataHandler[schema](app, data)(function (err, results) {
            handleSave(err, results, next);
        });
    };
    return ret1 || ret;
}
function getHandler ( app , schema , data ) { function handleSave ( err , results , next ) { if ( ! err ) { delete DependenciesMap [ schema ] ; SavedSchemas . push ( schema ) ; _l ( 'schema saved: ' + schema ) ; } next ( err , results ) ; } // Default handler function var ret = function ( next ) { data = _ . isObject ( data ) ? _ . values ( data ) : data ; DBActions . getSimpleInstance ( app , schema ) . multipleSave ( data , function ( err , results ) { handleSave ( err , results , next ) ; } ) ; } ; // Data handler provided in plugin var ret1 = SchemaDataHandler [ schema ] && function ( next ) { SchemaDataHandler [ schema ] ( app , data ) ( function ( err , results ) { handleSave ( err , results , next ) ; } ) ; } ; return ret1 || ret ; }
Returns data handler if provided with plugin otherwise return default handler function
@param app
@param schema {String} Schema name
@param data {Object|Array} default data
@returns {*|Function|Function}
Returns data handler if provided with plugin otherwise return default handler function