From 9a27e337a91e14ad9a636a8099e9100b68861eaf Mon Sep 17 00:00:00 2001 From: Dimitri Mizenko Date: Tue, 11 May 2021 12:05:12 +0200 Subject: [PATCH] attempt to fix github issue #135 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit removing the ‘&’ or ‘(‘ or ‘)’ symbols --- src-electron/util/string.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src-electron/util/string.js b/src-electron/util/string.js index 294162dd94c566..d73c1cc863fd27 100644 --- a/src-electron/util/string.js +++ b/src-electron/util/string.js @@ -26,8 +26,8 @@ * @parem {*} firstLower if True the it starts with lowecase. * @returns a spaced out string in lowercase */ -function toCamelCase(label, firstLower = true) { - let str = label.split(/ |_|-|\//) + function toCamelCase(label, firstLower = true) { + let str = label.replace(/[+()&]/g, '').split(/ |_|-|\//) let res = '' for (let i = 0; i < str.length; i++) { if (i == 0 && firstLower) { @@ -46,7 +46,7 @@ function toCamelCase(label, firstLower = true) { } function toSpacedLowercase(str) { - let res = str.replace(/\.?([A-Z][a-z])/g, function (x, y) { + let res = str.replace(/[+()&]/g, '').replace(/\.?([A-Z][a-z])/g, function (x, y) { return ' ' + y }) return res.toLowerCase() @@ -61,7 +61,7 @@ function toSpacedLowercase(str) { function toSnakeCaseAllCaps(label) { let ret = '' if (label == null) return ret - label = label.replace(/\.?([A-Z][a-z])/g, function (x, y) { + label = label.replace(/[+()&]/g, '').replace(/\.?([A-Z][a-z])/g, function (x, y) { return '_' + y }) let wasUp = false