wallet-core/node_modules/escape-string-regexp/index.js

12 lines
227 B
JavaScript
Raw Normal View History

2016-10-10 03:43:44 +02:00
'use strict';
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
module.exports = function (str) {
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
2016-11-03 01:33:53 +01:00
return str.replace(matchOperatorsRe, '\\$&');
2016-10-10 03:43:44 +02:00
};