|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
326 bytes
|
| Rev | Line | |
|---|
| [9af201e] | 1 | module.exports = { escape, unescape };
|
|---|
| 2 |
|
|---|
| 3 | function unescape(w) {
|
|---|
| 4 | w = w.charAt(0) === '"'
|
|---|
| 5 | ? w.replace(/^"|([^\\])"$/g, '$1')
|
|---|
| 6 | : w.replace(/\\ /g, ' ');
|
|---|
| 7 |
|
|---|
| 8 | return w.replace(/\\("|'|\$|`|\\)/g, '$1');
|
|---|
| 9 | }
|
|---|
| 10 |
|
|---|
| 11 | function escape(w) {
|
|---|
| 12 | w = w.replace(/(["'$`\\])/g,'\\$1');
|
|---|
| 13 | return w.match(/\s+/) ? `"${w}"` : w;
|
|---|
| 14 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.