Example #1
0
_configValidatorAndProcessor = function _configValidatorAndProcessor() {

    //> if _rulesConfig is not null / empty & not undefined
    if (!_.isEmpty(_rulesConfig) && !_.isUndefined(_rulesConfig)) {

        // check if its a valid object & if the contents of the object are valid 'String':Array[] maps
        if (_.isObject(_rulesConfig) && auditRunnerHelper.hasValidElements(_rulesConfig)) {
            //> pre-process rules that need to be ignored - do tasks
            //> on the config options object that is passed
            _preProcessRulesConfig();
        }else {
            throw new Error('Either Configuration options passed is not a valid object (or) its contents wasnt having valid String type as keys (or) the list of rules to skip were not of type Array.');
        }
    }

    //> execute global Rules only when the auditConfig.executeGlobalRules is TRUE & Not Undefined
    if (!_.isUndefined(_auditConfig) && _.isObject(_auditConfig)) {

        //> check if a compliance exists and if its a proper string (or) an Array, it can be let
        if (_.has(_auditConfig, 'compliance') && (_.isString(_auditConfig.compliance) || _auditConfig.compliance instanceof Array)) {
            _hasCompliance = true;
        }

        //> check if the key to execute global rules exists &
        //> if its a proper boolean
        if (_.has(_auditConfig, 'executeGlobalRules') && _.isBoolean(_auditConfig.executeGlobalRules)) {
            _mustRunGlobalRules = _auditConfig.executeGlobalRules;
        }

        //> display options are checked here. The user can request for Errors (or) Errors and Warnings
        if (_.has(_auditConfig, 'displayOptions') && _.isString(_auditConfig.displayOptions)) {
            _displayOptions = auditRunnerHelper.getDisplayEnum(_auditConfig.displayOptions);
        }
    }
};
Example #2
0
 _.forEach(keys, function(k){
   if (_.has(item, k)){
     let v = item[k];
     let dateFmt = Moment(v);
     item[k] = {
       date: dateFmt.toDate()
       , fmt: dateFmt
     };
   }
 });