examples/functions.js
function initCheckApi(logger, config) {

    return new Promise((resolve, reject) => {
        var check = new Check(logger, config);

        var promises = [];

        var checkers = require('mazaid-checkers');

        for (var checker of checkers) {
            promises.push(check.add(checker));
        }

        Promise.all(promises)
            .then(() => {
                return check.init();
            })
            .then(() => {
                checkApi = check;
                resolve();
            })
            .catch((error) => {
                reject(error);
            });
    });

}
function initCheckApi(logger, config) {

    return new Promise((resolve, reject) => {
        var check = new Check(logger, config);

        var promises = [];

        var checkers = require('mazaid-checkers');

        for (var checker of checkers) {
            promises.push(check.add(checker));
        }

        Promise.all(promises)
            .then(() => {
                return check.init();
            })
            .then(() => {
                checkApi = check;
                resolve();
            })
            .catch((error) => {
                reject(error);
            });
    });

}
function initCheckApi ( logger , config ) { return new Promise ( ( resolve , reject ) => { var check = new Check ( logger , config ) ; var promises = [ ] ; var checkers = require ( 'mazaid-checkers' ) ; for ( var checker of checkers ) { promises . push ( check . add ( checker ) ) ; } Promise . all ( promises ) . then ( ( ) => { return check . init ( ) ; } ) . then ( ( ) => { checkApi = check ; resolve ( ) ; } ) . catch ( ( error ) => { reject ( error ) ; } ) ; } ) ; }
init check api, add ping checker

@return {Promise}
init check api add ping checker