@mdf.js/utils
Version:
MMS - API Core - Common utils tools
22 lines • 725 B
JavaScript
;
/**
* Copyright 2024 Mytra Control S.L. All rights reserved.
*
* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
* or at https://opensource.org/licenses/MIT.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.escapeRegExp = escapeRegExp;
const tslib_1 = require("tslib");
const util_1 = tslib_1.__importDefault(require("util"));
/**
* Escape a regular expression string.
* @param regex - Regular expression to escape.
*/
function escapeRegExp(regex) {
if (!util_1.default.types.isRegExp(regex)) {
throw new TypeError('Expected a RegExp');
}
return regex.source;
}
//# sourceMappingURL=escapeStringRegexp.js.map