hexo/node_modules/sftp-sync-deploy/lib/util.js

17 lines
422 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Escapes regexp special chars
*/
function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
}
exports.escapeRegExp = escapeRegExp;
/**
* Trim trailing char
*/
function chomp(str, char) {
return str.replace(new RegExp(escapeRegExp(char) + '+$'), '');
}
exports.chomp = chomp;