function normalizeDimensionsDefine(dimensionsDefine) {
    if (!dimensionsDefine) {
        // The meaning of null/undefined is different from empty array.
        return;
    }
    var nameMap = createHashMap();
    return map(dimensionsDefine, function (item, index) {
        item = extend({}, isObject(item) ? item : {name: item});

        // User can set null in dimensions.
        // We dont auto specify name, othewise a given name may
        // cause it be refered unexpectedly.
        if (item.name == null) {
            return item;
        }

        // Also consider number form like 2012.
        item.name += '';
        // User may also specify displayName.
        // displayName will always exists except user not
        // specified or dim name is not specified or detected.
        // (A auto generated dim name will not be used as
        // displayName).
        if (item.displayName == null) {
            item.displayName = item.name;
        }

        var exist = nameMap.get(item.name);
        if (!exist) {
            nameMap.set(item.name, {count: 1});
        }
        else {
            item.name += '-' + exist.count++;
        }

        return item;
    });
}
function normalizeDimensionsDefine(dimensionsDefine) {
    if (!dimensionsDefine) {
        // The meaning of null/undefined is different from empty array.
        return;
    }
    var nameMap = createHashMap();
    return map(dimensionsDefine, function (item, index) {
        item = extend({}, isObject(item) ? item : {name: item});

        // User can set null in dimensions.
        // We dont auto specify name, othewise a given name may
        // cause it be refered unexpectedly.
        if (item.name == null) {
            return item;
        }

        // Also consider number form like 2012.
        item.name += '';
        // User may also specify displayName.
        // displayName will always exists except user not
        // specified or dim name is not specified or detected.
        // (A auto generated dim name will not be used as
        // displayName).
        if (item.displayName == null) {
            item.displayName = item.name;
        }

        var exist = nameMap.get(item.name);
        if (!exist) {
            nameMap.set(item.name, {count: 1});
        }
        else {
            item.name += '-' + exist.count++;
        }

        return item;
    });
}
function normalizeDimensionsDefine ( dimensionsDefine ) { if ( ! dimensionsDefine ) { // The meaning of null/undefined is different from empty array. return ; } var nameMap = createHashMap ( ) ; return map ( dimensionsDefine , function ( item , index ) { item = extend ( { } , isObject ( item ) ? item : { name : item } ) ; // User can set null in dimensions. // We dont auto specify name, othewise a given name may // cause it be refered unexpectedly. if ( item . name == null ) { return item ; } // Also consider number form like 2012. item . name += '' ; // User may also specify displayName. // displayName will always exists except user not // specified or dim name is not specified or detected. // (A auto generated dim name will not be used as // displayName). if ( item . displayName == null ) { item . displayName = item . name ; } var exist = nameMap . get ( item . name ) ; if ( ! exist ) { nameMap . set ( item . name , { count : 1 } ) ; } else { item . name += '-' + exist . count ++ ; } return item ; } ) ; }
Consider dimensions defined like ['A', 'price', 'B', 'price', 'C', 'price'], which is reasonable. But dimension name is duplicated. Returns undefined or an array contains only object without null/undefiend or string.
Consider dimensions defined like [ A price B price C price ] which is reasonable . But dimension name is duplicated . Returns undefined or an array contains only object without null / undefiend or string .
Normalizes dimensionsDefine array.