|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
497 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | module.exports = function quote(xs) {
|
|---|
| 4 | return xs.map(function (s) {
|
|---|
| 5 | if (s === '') {
|
|---|
| 6 | return '\'\'';
|
|---|
| 7 | }
|
|---|
| 8 | if (s && typeof s === 'object') {
|
|---|
| 9 | return s.op.replace(/(.)/g, '\\$1');
|
|---|
| 10 | }
|
|---|
| 11 | if ((/["\s\\]/).test(s) && !(/'/).test(s)) {
|
|---|
| 12 | return "'" + s.replace(/(['])/g, '\\$1') + "'";
|
|---|
| 13 | }
|
|---|
| 14 | if ((/["'\s]/).test(s)) {
|
|---|
| 15 | return '"' + s.replace(/(["\\$`!])/g, '\\$1') + '"';
|
|---|
| 16 | }
|
|---|
| 17 | return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, '$1\\$2');
|
|---|
| 18 | }).join(' ');
|
|---|
| 19 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.