lib/common/tbl.js
function(fileName, tmpL, idx, indexColumn) {
    var self = this;
    var fNameList = tmpL.splice(0, 1)[0];
    var fTypeList = tmpL.splice(0, 1)[0];
    if (indexColumn != undefined) {
        idx = fNameList[indexColumn];
    }
    var fieldsName = {};
    fNameList.forEach(function(value, index) {
        fieldsName[value] = index;
    });
    self.data = {};
    tmpL.forEach(function(item) {
        var obj = {};
        for (var k in fieldsName) {
            //obj[k] = item[fieldsName[k]];
            var retVal = parseValue(item[fieldsName[k]], fTypeList[fieldsName[k]]);
            if (retVal == undefined) {
                logger.error('Parse config file "{}" \'s filed "{}" error,the value is:"{}",the type is:"{}"'.format(fileName, k, item[fieldsName[k]], fTypeList[fieldsName[k]]))
            }
            obj[k] = retVal
        }
        if (self.data.hasOwnProperty(obj[idx])) {
            logger.error('Index column can not have duplicate value,please check the config file :%s', fileName + '.csv');
        } else {
            if (obj[idx]) {
                self.data[obj[idx]] = obj;
            } else {
                logger.error('No `%s` exists in tbl=%s', idx, util.inspect(fNameList, {
                    showHidden: false,
                    depth: 1
                }));
            }
        }
    });
}
function(fileName, tmpL, idx, indexColumn) {
    var self = this;
    var fNameList = tmpL.splice(0, 1)[0];
    var fTypeList = tmpL.splice(0, 1)[0];
    if (indexColumn != undefined) {
        idx = fNameList[indexColumn];
    }
    var fieldsName = {};
    fNameList.forEach(function(value, index) {
        fieldsName[value] = index;
    });
    self.data = {};
    tmpL.forEach(function(item) {
        var obj = {};
        for (var k in fieldsName) {
            //obj[k] = item[fieldsName[k]];
            var retVal = parseValue(item[fieldsName[k]], fTypeList[fieldsName[k]]);
            if (retVal == undefined) {
                logger.error('Parse config file "{}" \'s filed "{}" error,the value is:"{}",the type is:"{}"'.format(fileName, k, item[fieldsName[k]], fTypeList[fieldsName[k]]))
            }
            obj[k] = retVal
        }
        if (self.data.hasOwnProperty(obj[idx])) {
            logger.error('Index column can not have duplicate value,please check the config file :%s', fileName + '.csv');
        } else {
            if (obj[idx]) {
                self.data[obj[idx]] = obj;
            } else {
                logger.error('No `%s` exists in tbl=%s', idx, util.inspect(fNameList, {
                    showHidden: false,
                    depth: 1
                }));
            }
        }
    });
}
function ( fileName , tmpL , idx , indexColumn ) { var self = this ; var fNameList = tmpL . splice ( 0 , 1 ) [ 0 ] ; var fTypeList = tmpL . splice ( 0 , 1 ) [ 0 ] ; if ( indexColumn != undefined ) { idx = fNameList [ indexColumn ] ; } var fieldsName = { } ; fNameList . forEach ( function ( value , index ) { fieldsName [ value ] = index ; } ) ; self . data = { } ; tmpL . forEach ( function ( item ) { var obj = { } ; for ( var k in fieldsName ) { //obj[k] = item[fieldsName[k]]; var retVal = parseValue ( item [ fieldsName [ k ] ] , fTypeList [ fieldsName [ k ] ] ) ; if ( retVal == undefined ) { logger . error ( 'Parse config file "{}" \'s filed "{}" error,the value is:"{}",the type is:"{}"' . format ( fileName , k , item [ fieldsName [ k ] ] , fTypeList [ fieldsName [ k ] ] ) ) } obj [ k ] = retVal } if ( self . data . hasOwnProperty ( obj [ idx ] ) ) { logger . error ( 'Index column can not have duplicate value,please check the config file :%s' , fileName + '.csv' ) ; } else { if ( obj [ idx ] ) { self . data [ obj [ idx ] ] = obj ; } else { logger . error ( 'No `%s` exists in tbl=%s' , idx , util . inspect ( fNameList , { showHidden : false , depth : 1 } ) ) ; } } } ) ; }
Tbl model `new Tbl()`

@param {Array}
Tbl model new Tbl ()