From 7eb2c68090a7e4f11fed7e88950a9e1d56d91a39 Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Mon, 11 Sep 2017 15:31:34 -0400 Subject: [PATCH] removed bookkeeping object, it was adding unneeded complexity --- helper/geojsonify_place_details.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/helper/geojsonify_place_details.js b/helper/geojsonify_place_details.js index d9d3ade2..bbe48d2c 100644 --- a/helper/geojsonify_place_details.js +++ b/helper/geojsonify_place_details.js @@ -66,28 +66,23 @@ function copyProperties( params, source, dst ) { return; } - var property = { - name: prop.name || prop, - type: prop.type || 'default' - }; - var value = null; - if ( source.hasOwnProperty( property.name ) ) { + if ( source.hasOwnProperty( prop.name ) ) { - switch (property.type) { + switch (_.defaultTo(prop.type, 'default')) { case 'string': - value = getStringValue(source[property.name]); + value = getStringValue(source[prop.name]); break; case 'array': - value = getArrayValue(source[property.name]); + value = getArrayValue(source[prop.name]); break; // default behavior is to copy property exactly as is default: - value = source[property.name]; + value = source[prop.name]; } if (_.isNumber(value) || (value && !_.isEmpty(value))) { - dst[property.name] = value; + dst[prop.name] = value; } } });