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

17 lines
422 B
JavaScript
Raw Normal View History

2023-10-03 11:14:36 +08:00
"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;