mirror of
https://github.com/flynx/types.js.git
synced 2025-10-29 18:40:07 +00:00
37 lines
1002 B
JavaScript
37 lines
1002 B
JavaScript
/**********************************************************************
|
|
*
|
|
*
|
|
*
|
|
**********************************************/ /* c8 ignore next 2 */
|
|
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
|
(function(require){ var module={} // make module AMD/node compatible...
|
|
/*********************************************************************/
|
|
|
|
var object = require('ig-object')
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
var RegExpMixin =
|
|
module.RegExpMixin =
|
|
object.Mixin('RegExpMixin', 'soft', {
|
|
// Quote a string and convert to RegExp to match self literally.
|
|
quoteRegExp: function(str){
|
|
return str
|
|
.replace(/([\.\\\/\(\)\[\]\$\*\+\-\{\}\@\^\&\?\<\>])/g, '\\$1') }
|
|
})
|
|
|
|
|
|
RegExpMixin(RegExp)
|
|
|
|
|
|
var quoteRegExp =
|
|
RegExp.quoteRegExp =
|
|
RegExp.quoteRegExp
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
* vim:set ts=4 sw=4 : */ return module })
|