diff options
Diffstat (limited to 'node_modules/locutus/php/exec/escapeshellarg.js')
-rw-r--r-- | node_modules/locutus/php/exec/escapeshellarg.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/node_modules/locutus/php/exec/escapeshellarg.js b/node_modules/locutus/php/exec/escapeshellarg.js new file mode 100644 index 0000000..3672042 --- /dev/null +++ b/node_modules/locutus/php/exec/escapeshellarg.js @@ -0,0 +1,18 @@ +'use strict'; + +module.exports = function escapeshellarg(arg) { + // discuss at: http://locutus.io/php/escapeshellarg/ + // original by: Felix Geisendoerfer (http://www.debuggable.com/felix) + // improved by: Brett Zamir (http://brett-zamir.me) + // example 1: escapeshellarg("kevin's birthday") + // returns 1: "'kevin\\'s birthday'" + + var ret = ''; + + ret = arg.replace(/[^\\]'/g, function (m, i, s) { + return m.slice(0, 1) + '\\\''; + }); + + return "'" + ret + "'"; +}; +//# sourceMappingURL=escapeshellarg.js.map
\ No newline at end of file |