From d07e3e6d97fb7760e3c34f10bb57eaf2534cf884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 22 Oct 2018 20:08:31 -0400 Subject: [PATCH] if not in defaults use string --- src/meta/configs.js | 2 +- test/meta.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/meta/configs.js b/src/meta/configs.js index b9f695a8ce..a3269a5c0e 100644 --- a/src/meta/configs.js +++ b/src/meta/configs.js @@ -22,7 +22,7 @@ function deserialize(config) { const defaultType = typeof defaults[key]; const type = typeof config[key]; - if (defaultType === 'string' && type === 'number') { + if ((defaultType === 'string' || defaultType === 'undefined') && type === 'number') { deserialized[key] = String(config[key]); } else if (defaultType === 'number' && type === 'string') { const number = parseFloat(config[key]); diff --git a/test/meta.js b/test/meta.js index 90e7d577f6..df15081afd 100644 --- a/test/meta.js +++ b/test/meta.js @@ -213,12 +213,12 @@ describe('meta', function () { }); }); - it('should set numeric config value', function (done) { + it('should get back string if field is not in defaults', function (done) { meta.configs.set('numericField', 123, function (err) { assert.ifError(err); meta.configs.getFields(['numericField'], function (err, data) { assert.ifError(err); - assert.strictEqual(data.numericField, 123); + assert.strictEqual(data.numericField, '123'); done(); }); });