From 7cef177a936530b9f93f977b79c362b619b26aea Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Wed, 24 Feb 2016 15:40:15 -0500 Subject: [PATCH] inlined method for clarity --- helper/labelGenerator.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/helper/labelGenerator.js b/helper/labelGenerator.js index e562916b..69af73b8 100644 --- a/helper/labelGenerator.js +++ b/helper/labelGenerator.js @@ -7,6 +7,7 @@ module.exports = function( record ){ var labelParts = [ record.name.default ]; + // get the schema to use for the records' country var schema = getSchema(record.country_a); var buildOutput = function(parts, schemaArr, record) { @@ -24,10 +25,9 @@ module.exports = function( record ){ labelParts = buildOutput(labelParts, schema[key], record); } - // de-dupe outputs - labelParts = _.unique( labelParts ); + // de-dupe, join with comma, trim, return + return _.unique( labelParts ).join(', ').trim(); - return labelParts.join(', ').trim(); }; // helper method that determines which schema to use based on country alpha3