packages/optimizely-sdk/lib/core/project_config/index.js
function(projectConfig, featureKey, variableKey, logger) {
    var feature = projectConfig.featureKeyMap[featureKey];
    if (!feature) {
      logger.log(LOG_LEVEL.ERROR, sprintf(ERROR_MESSAGES.FEATURE_NOT_IN_DATAFILE, MODULE_NAME, featureKey));
      return null;
    }

    var variable = feature.variableKeyMap[variableKey];
    if (!variable) {
      logger.log(LOG_LEVEL.ERROR, sprintf(ERROR_MESSAGES.VARIABLE_KEY_NOT_IN_DATAFILE, MODULE_NAME, variableKey, featureKey));
      return null;
    }

    return variable;
  }
function(projectConfig, featureKey, variableKey, logger) {
    var feature = projectConfig.featureKeyMap[featureKey];
    if (!feature) {
      logger.log(LOG_LEVEL.ERROR, sprintf(ERROR_MESSAGES.FEATURE_NOT_IN_DATAFILE, MODULE_NAME, featureKey));
      return null;
    }

    var variable = feature.variableKeyMap[variableKey];
    if (!variable) {
      logger.log(LOG_LEVEL.ERROR, sprintf(ERROR_MESSAGES.VARIABLE_KEY_NOT_IN_DATAFILE, MODULE_NAME, variableKey, featureKey));
      return null;
    }

    return variable;
  }
function ( projectConfig , featureKey , variableKey , logger ) { var feature = projectConfig . featureKeyMap [ featureKey ] ; if ( ! feature ) { logger . log ( LOG_LEVEL . ERROR , sprintf ( ERROR_MESSAGES . FEATURE_NOT_IN_DATAFILE , MODULE_NAME , featureKey ) ) ; return null ; } var variable = feature . variableKeyMap [ variableKey ] ; if ( ! variable ) { logger . log ( LOG_LEVEL . ERROR , sprintf ( ERROR_MESSAGES . VARIABLE_KEY_NOT_IN_DATAFILE , MODULE_NAME , variableKey , featureKey ) ) ; return null ; } return variable ; }
Get the variable with the given key associated with the feature with the
given key. If the feature key or the variable key are invalid, log an error
message.
@param {Object} projectConfig
@param {string} featureKey
@param {string} variableKey
@param {Object} logger
@return {Object|null} Variable object, or null one or both of the given
feature and variable keys are invalid
Get the variable with the given key associated with the feature with the given key . If the feature key or the variable key are invalid log an error message .