Browse Source

add line comment, fix line comment

pull/1102/head
missinglink 7 years ago
parent
commit
59f0f4d70e
  1. 2
      helper/fieldValue.js
  2. 3
      test/unit/helper/fieldValue.js

2
helper/fieldValue.js

@ -17,7 +17,7 @@ function getStringValue(property) {
return property; return property;
} }
// array value, take first item in array (at this time only used for admin values) // array value, take first item in array (at this time only used for admin & name values)
if (_.isArray(property)) { if (_.isArray(property)) {
return property[0]; return property[0];
} }

3
test/unit/helper/fieldValue.js

@ -11,6 +11,9 @@ module.exports.tests.getStringValue = function(test) {
t.equal(field.getStringValue(['']), '', 'array with empty string'); t.equal(field.getStringValue(['']), '', 'array with empty string');
t.equal(field.getStringValue(-0), '-0', 'number'); t.equal(field.getStringValue(-0), '-0', 'number');
t.equal(field.getStringValue(+0), '0', 'number'); t.equal(field.getStringValue(+0), '0', 'number');
// note: this behaviour is not desirable, it was inherited during a refactor
// see: https://github.com/pelias/api/pull/1102
t.equal(field.getStringValue({foo: 'bar'}), '[object Object]', '_.toString'); t.equal(field.getStringValue({foo: 'bar'}), '[object Object]', '_.toString');
t.end(); t.end();
}); });

Loading…
Cancel
Save