e5850ca5f4997aeca86d135f4c229754162d97fc
[aai/esr-gui.git] /
1
2 var toString = Object.prototype.toString;
3
4 function isRegExp (o) {
5   return 'object' == typeof o
6       && '[object RegExp]' == toString.call(o);
7 }
8
9 module.exports = exports = function (regexp) {
10   if (!isRegExp(regexp)) {
11     throw new TypeError('Not a RegExp');
12   }
13
14   var flags = [];
15   if (regexp.global) flags.push('g');
16   if (regexp.multiline) flags.push('m');
17   if (regexp.ignoreCase) flags.push('i');
18   return new RegExp(regexp.source, flags.join(''));
19 }
20