Browse Source

added helper method for clarification

modify-label-generation-for-wof
Stephen Hess 9 years ago
parent
commit
3b454600e5
  1. 15
      helper/labelGenerator.js

15
helper/labelGenerator.js

@ -7,11 +7,7 @@ module.exports = function( record ){
var labelParts = [ record.name.default ];
var schema = schemas.default;
if (record.country_a && record.country_a.length && schemas[record.country_a]) {
schema = schemas[record.country_a];
}
var schema = getSchema(record.country_a);
var buildOutput = function(parts, schemaArr, record) {
for (var i=0; i<schemaArr.length; i++) {
@ -33,3 +29,12 @@ module.exports = function( record ){
return labelParts.join(', ').trim();
};
// helper method that determines which schema to use based on country alpha3
function getSchema(country_a) {
if (country_a && country_a.length && schemas[country_a]) {
return schemas[country_a];
}
return schemas.default;
}

Loading…
Cancel
Save