123456789101112131415161718192021222324252627282930 |
- 'use strict'
- var path = require('path')
- var isWindows = require('./is-windows.js')
- module.exports = escapify
- function windowsQuotes (str) {
- if (!/ /.test(str)) return str
- return '"' + str + '"'
- }
- function escapify (str) {
- if (isWindows) {
- return path.normalize(str).split(/\\/).map(windowsQuotes).join('\\')
- } else if (/[^-_.~/\w]/.test(str)) {
- return "'" + str.replace(/'/g, "'\"'\"'") + "'"
- } else {
- return str
- }
- }
|