Use string slice instead of replace
This commit is contained in:
parent
1edfda5417
commit
1dc24fac1b
|
@ -198,7 +198,7 @@ var usercss = (() => {
|
||||||
if (Array.isArray(state.value)) {
|
if (Array.isArray(state.value)) {
|
||||||
result.options = state.value.map(text => {
|
result.options = state.value.map(text => {
|
||||||
if (text.endsWith('*')) {
|
if (text.endsWith('*')) {
|
||||||
text = text.replace(/\*$/, '');
|
text = text.slice(0, -1);
|
||||||
defaultValue = text;
|
defaultValue = text;
|
||||||
}
|
}
|
||||||
return createOption(text);
|
return createOption(text);
|
||||||
|
@ -206,8 +206,8 @@ var usercss = (() => {
|
||||||
} else {
|
} else {
|
||||||
result.options = Object.keys(state.value).map(k => {
|
result.options = Object.keys(state.value).map(k => {
|
||||||
if (k.endsWith('*')) {
|
if (k.endsWith('*')) {
|
||||||
state.value[k] = state.value[k].replace(/\*$/, '');
|
state.value[k] = state.value[k].slice(0, -1);
|
||||||
k = k.replace(/\*$/, '');
|
k = k.slice(0, -1);
|
||||||
defaultValue = k;
|
defaultValue = k;
|
||||||
}
|
}
|
||||||
return createOption(k, state.value[k]);
|
return createOption(k, state.value[k]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user