Browse Source

inlined method for clarity

modify-label-generation-for-wof
Stephen Hess 9 years ago
parent
commit
7cef177a93
  1. 6
      helper/labelGenerator.js

6
helper/labelGenerator.js

@ -7,6 +7,7 @@ module.exports = function( record ){
var labelParts = [ record.name.default ]; var labelParts = [ record.name.default ];
// get the schema to use for the records' country
var schema = getSchema(record.country_a); var schema = getSchema(record.country_a);
var buildOutput = function(parts, schemaArr, record) { var buildOutput = function(parts, schemaArr, record) {
@ -24,10 +25,9 @@ module.exports = function( record ){
labelParts = buildOutput(labelParts, schema[key], record); labelParts = buildOutput(labelParts, schema[key], record);
} }
// de-dupe outputs // de-dupe, join with comma, trim, return
labelParts = _.unique( labelParts ); return _.unique( labelParts ).join(', ').trim();
return labelParts.join(', ').trim();
}; };
// helper method that determines which schema to use based on country alpha3 // helper method that determines which schema to use based on country alpha3

Loading…
Cancel
Save