lib/Models/AbsIttCatalogItem.js
function getHumanReadableConceptName(conceptNameMap, concept) {
  if (!defined(conceptNameMap[concept.name])) {
    return concept.name; // Default to the name given in the file.
  }
  if (typeof conceptNameMap[concept.name] === "string") {
    return conceptNameMap[concept.name];
  } else {
    var codeMap = conceptNameMap[concept.name];
    for (var j = 0; j < concept.items.length; j++) {
      if (defined(codeMap[concept.items[j].name])) {
        return codeMap[concept.items[j].name];
      }
    }
    // Use the wildcard, if defined, or else fall back to the name in the file.
    return codeMap["*"] || concept.name;
  }
}
function getHumanReadableConceptName(conceptNameMap, concept) {
  if (!defined(conceptNameMap[concept.name])) {
    return concept.name; // Default to the name given in the file.
  }
  if (typeof conceptNameMap[concept.name] === "string") {
    return conceptNameMap[concept.name];
  } else {
    var codeMap = conceptNameMap[concept.name];
    for (var j = 0; j < concept.items.length; j++) {
      if (defined(codeMap[concept.items[j].name])) {
        return codeMap[concept.items[j].name];
      }
    }
    // Use the wildcard, if defined, or else fall back to the name in the file.
    return codeMap["*"] || concept.name;
  }
}
function getHumanReadableConceptName ( conceptNameMap , concept ) { if ( ! defined ( conceptNameMap [ concept . name ] ) ) { return concept . name ; // Default to the name given in the file. } if ( typeof conceptNameMap [ concept . name ] === "string" ) { return conceptNameMap [ concept . name ] ; } else { var codeMap = conceptNameMap [ concept . name ] ; for ( var j = 0 ; j < concept . items . length ; j ++ ) { if ( defined ( codeMap [ concept . items [ j ] . name ] ) ) { return codeMap [ concept . items [ j ] . name ] ; } } // Use the wildcard, if defined, or else fall back to the name in the file. return codeMap [ "*" ] || concept . name ; } }
Given a concept object with name and possibly items properties, return its human-readable version.
@private
@param  {Object} conceptNameMap An object whose keys are the concept.names, eg. "ANCP".
Values may be Strings (eg. "Ancestry"), or
a 'code map' (eg. "MEASURE" : {"Persons": "Sex", "85 years and over": "Age", "*": "Measure"}.
@param  {AbsConcept} concept An object with a name property and, if a codemap is to be used, an items array of objects with a name property.
In that case, it finds the first of those names to appear as a key in the code map. The value of this property is returned. (Phew!)
@return {String} Human-readable concept name.
Given a concept object with name and possibly items properties return its human - readable version .