lib/Map/AbsConcept.js
function buildConceptTree(parent, filter, concept, codes) {
  // Use natural sort for fields with included ages or incomes.
  codes.sort(function(a, b) {
    return naturalSort(
      a.description.replace(",", ""),
      b.description.replace(",", "")
    );
  });
  var anyActive = false;
  for (var i = 0; i < codes.length; ++i) {
    var parentCode = parent instanceof AbsCode ? parent.code : "";
    if (codes[i].parentCode === parentCode) {
      var absCode = new AbsCode(codes[i].code, codes[i].description, concept);
      var codeFilter = concept.id + "." + absCode.code;
      if (defined(filter) && filter.indexOf(codeFilter) !== -1) {
        absCode.isActive = true;
        anyActive = true;
      }
      if (parentCode === "" && codes.length < 50) {
        absCode.isOpen = true;
      }
      absCode.parent = parent;
      parent.items.push(absCode);
      var anyChildrenActive = buildConceptTree(absCode, filter, concept, codes);
      anyActive = anyChildrenActive || anyActive;
    }
  }
  return anyActive;
}
function buildConceptTree(parent, filter, concept, codes) {
  // Use natural sort for fields with included ages or incomes.
  codes.sort(function(a, b) {
    return naturalSort(
      a.description.replace(",", ""),
      b.description.replace(",", "")
    );
  });
  var anyActive = false;
  for (var i = 0; i < codes.length; ++i) {
    var parentCode = parent instanceof AbsCode ? parent.code : "";
    if (codes[i].parentCode === parentCode) {
      var absCode = new AbsCode(codes[i].code, codes[i].description, concept);
      var codeFilter = concept.id + "." + absCode.code;
      if (defined(filter) && filter.indexOf(codeFilter) !== -1) {
        absCode.isActive = true;
        anyActive = true;
      }
      if (parentCode === "" && codes.length < 50) {
        absCode.isOpen = true;
      }
      absCode.parent = parent;
      parent.items.push(absCode);
      var anyChildrenActive = buildConceptTree(absCode, filter, concept, codes);
      anyActive = anyChildrenActive || anyActive;
    }
  }
  return anyActive;
}
function buildConceptTree ( parent , filter , concept , codes ) { // Use natural sort for fields with included ages or incomes. codes . sort ( function ( a , b ) { return naturalSort ( a . description . replace ( "," , "" ) , b . description . replace ( "," , "" ) ) ; } ) ; var anyActive = false ; for ( var i = 0 ; i < codes . length ; ++ i ) { var parentCode = parent instanceof AbsCode ? parent . code : "" ; if ( codes [ i ] . parentCode === parentCode ) { var absCode = new AbsCode ( codes [ i ] . code , codes [ i ] . description , concept ) ; var codeFilter = concept . id + "." + absCode . code ; if ( defined ( filter ) && filter . indexOf ( codeFilter ) !== - 1 ) { absCode . isActive = true ; anyActive = true ; } if ( parentCode === "" && codes . length < 50 ) { absCode . isOpen = true ; } absCode . parent = parent ; parent . items . push ( absCode ) ; var anyChildrenActive = buildConceptTree ( absCode , filter , concept , codes ) ; anyActive = anyChildrenActive || anyActive ; } } return anyActive ; }
Recursively builds out the AbsCodes underneath this AbsConcept. Returns true if any codes were made active, false if none.
Recursively builds out the AbsCodes underneath this AbsConcept . Returns true if any codes were made active false if none .