From 1dc24fac1bf0c4adda448bd69eb142473e3fd56c Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Wed, 5 Sep 2018 07:47:01 -0500 Subject: [PATCH] Use string slice instead of replace --- js/usercss.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/usercss.js b/js/usercss.js index 6fabf2a5..3ad4f514 100644 --- a/js/usercss.js +++ b/js/usercss.js @@ -198,7 +198,7 @@ var usercss = (() => { if (Array.isArray(state.value)) { result.options = state.value.map(text => { if (text.endsWith('*')) { - text = text.replace(/\*$/, ''); + text = text.slice(0, -1); defaultValue = text; } return createOption(text); @@ -206,8 +206,8 @@ var usercss = (() => { } else { result.options = Object.keys(state.value).map(k => { if (k.endsWith('*')) { - state.value[k] = state.value[k].replace(/\*$/, ''); - k = k.replace(/\*$/, ''); + state.value[k] = state.value[k].slice(0, -1); + k = k.slice(0, -1); defaultValue = k; } return createOption(k, state.value[k]);