|
|
@ -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
|
|
|
|