From 449087e6f3e1d5c35d093a1a28c1ba8f59b37079 Mon Sep 17 00:00:00 2001 From: Sebastien Jourdain Date: Tue, 23 Jan 2018 15:11:20 -0700 Subject: [PATCH] fix(PropertyFactory): Fix capitalize function --- src/React/Properties/PropertyFactory/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/React/Properties/PropertyFactory/index.js b/src/React/Properties/PropertyFactory/index.js index 1ac6cb222b..e675817021 100644 --- a/src/React/Properties/PropertyFactory/index.js +++ b/src/React/Properties/PropertyFactory/index.js @@ -26,12 +26,17 @@ const factoryMapping = { /* eslint-enable max-len */ -function capitalize(str) { +function capitalizeOld(str) { return str[0].toUpperCase() + str.substr(1).toLowerCase(); } + +function capitalize(str) { + return str[0].toUpperCase() + str.substr(1); +} + export default function render(prop, vd, onChange) { - var fn = factoryMapping[capitalize(prop.ui.propType)]; + var fn = factoryMapping[capitalize(prop.ui.propType)] || factoryMapping[capitalizeOld(prop.ui.propType)]; if (fn) { return fn(prop, vd, onChange); }