|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
502 bytes
|
| Line | |
|---|
| 1 | const matchValueName = /[$]?[\w-]+/g;
|
|---|
| 2 |
|
|---|
| 3 | const replaceValueSymbols = (value, replacements) => {
|
|---|
| 4 | let matches;
|
|---|
| 5 |
|
|---|
| 6 | while ((matches = matchValueName.exec(value))) {
|
|---|
| 7 | const replacement = replacements[matches[0]];
|
|---|
| 8 |
|
|---|
| 9 | if (replacement) {
|
|---|
| 10 | value =
|
|---|
| 11 | value.slice(0, matches.index) +
|
|---|
| 12 | replacement +
|
|---|
| 13 | value.slice(matchValueName.lastIndex);
|
|---|
| 14 |
|
|---|
| 15 | matchValueName.lastIndex -= matches[0].length - replacement.length;
|
|---|
| 16 | }
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | return value;
|
|---|
| 20 | };
|
|---|
| 21 |
|
|---|
| 22 | module.exports = replaceValueSymbols;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.