index.js
function(fullContext, activeDimensions, usedValues, setting) {
        var height = this.dimensionsList.length;
        var newContext = new Array(height);
        for(var i=0; i<height; i++) {
            newContext[i] = 0;
        }
        var activeIndex = 0;
        for(i=0; i<fullContext.length; i++) {
            if(activeDimensions[i]) {
                var dimensionName = this.dimensionsList[activeIndex];
                var contextValue = fullContext[i];
                if(contextValue.constructor === Array) {
                    var newValue = [];
                    for(var k=0; k<contextValue.length; k++) {
                        var valueChunk = contextValue[k];
                        if(usedValues[dimensionName][valueChunk] === 2) {
                            newValue.push(this.valueToNumber[dimensionName][valueChunk]);
                        } else {
                            console.log('WARNING: invalid value "' + valueChunk + '" for dimension "' +
                                dimensionName + '" in settings ' + JSON.stringify(setting));
                        }
                    }
                    if(newValue.length === 0) {
                        return;
                    }
                    newContext[activeIndex] = newValue;
                } else {
                    if(usedValues[dimensionName][contextValue] === 2) {
                        newContext[activeIndex] = this.valueToNumber[dimensionName][contextValue];
                    } else if(contextValue !== DEFAULT) {
                        console.log('WARNING: invalid value "' + contextValue + '" for dimension "' +
                            dimensionName + '" in settings ' + JSON.stringify(setting));
                        return;
                    }
                }
                activeIndex++;
            }
        }
        return newContext;
    }
function(fullContext, activeDimensions, usedValues, setting) {
        var height = this.dimensionsList.length;
        var newContext = new Array(height);
        for(var i=0; i<height; i++) {
            newContext[i] = 0;
        }
        var activeIndex = 0;
        for(i=0; i<fullContext.length; i++) {
            if(activeDimensions[i]) {
                var dimensionName = this.dimensionsList[activeIndex];
                var contextValue = fullContext[i];
                if(contextValue.constructor === Array) {
                    var newValue = [];
                    for(var k=0; k<contextValue.length; k++) {
                        var valueChunk = contextValue[k];
                        if(usedValues[dimensionName][valueChunk] === 2) {
                            newValue.push(this.valueToNumber[dimensionName][valueChunk]);
                        } else {
                            console.log('WARNING: invalid value "' + valueChunk + '" for dimension "' +
                                dimensionName + '" in settings ' + JSON.stringify(setting));
                        }
                    }
                    if(newValue.length === 0) {
                        return;
                    }
                    newContext[activeIndex] = newValue;
                } else {
                    if(usedValues[dimensionName][contextValue] === 2) {
                        newContext[activeIndex] = this.valueToNumber[dimensionName][contextValue];
                    } else if(contextValue !== DEFAULT) {
                        console.log('WARNING: invalid value "' + contextValue + '" for dimension "' +
                            dimensionName + '" in settings ' + JSON.stringify(setting));
                        return;
                    }
                }
                activeIndex++;
            }
        }
        return newContext;
    }
function ( fullContext , activeDimensions , usedValues , setting ) { var height = this . dimensionsList . length ; var newContext = new Array ( height ) ; for ( var i = 0 ; i < height ; i ++ ) { newContext [ i ] = 0 ; } var activeIndex = 0 ; for ( i = 0 ; i < fullContext . length ; i ++ ) { if ( activeDimensions [ i ] ) { var dimensionName = this . dimensionsList [ activeIndex ] ; var contextValue = fullContext [ i ] ; if ( contextValue . constructor === Array ) { var newValue = [ ] ; for ( var k = 0 ; k < contextValue . length ; k ++ ) { var valueChunk = contextValue [ k ] ; if ( usedValues [ dimensionName ] [ valueChunk ] === 2 ) { newValue . push ( this . valueToNumber [ dimensionName ] [ valueChunk ] ) ; } else { console . log ( 'WARNING: invalid value "' + valueChunk + '" for dimension "' + dimensionName + '" in settings ' + JSON . stringify ( setting ) ) ; } } if ( newValue . length === 0 ) { return ; } newContext [ activeIndex ] = newValue ; } else { if ( usedValues [ dimensionName ] [ contextValue ] === 2 ) { newContext [ activeIndex ] = this . valueToNumber [ dimensionName ] [ contextValue ] ; } else if ( contextValue !== DEFAULT ) { console . log ( 'WARNING: invalid value "' + contextValue + '" for dimension "' + dimensionName + '" in settings ' + JSON . stringify ( setting ) ) ; return ; } } activeIndex ++ ; } } return newContext ; }
Convert config context and omit invalid dimension values.
@param fullContext {array}
@param activeDimensions {array}
@param usedValues {object}
@param setting {object}
@returns {array}
@private
Convert config context and omit invalid dimension values .