regexp-escape-x
Advanced tools
Comparing version 1.1.0 to 1.1.1
34
index.js
@@ -23,22 +23,9 @@ /** | ||
* | ||
* regexpEscape module. | ||
* ECMAScript proposed RegExp.escape. | ||
* | ||
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2> | ||
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5 | ||
* methods that can be faithfully emulated with a legacy JavaScript engine. | ||
* Requires ES3 or above. | ||
* | ||
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible. | ||
* For these methods, as closely as possible to ES5 is not very close. | ||
* Many of these shams are intended only to allow code to be written to ES5 | ||
* without causing run-time errors in older engines. In many cases, | ||
* this means that these shams cause many ES5 methods to silently fail. | ||
* Decide carefully whether this is what you want. Note: es5-sham.js requires | ||
* es5-shim.js to be able to work properly. | ||
* @see {@link https://github.com/benjamingr/RegExp.escape|RegExp.escape} | ||
* | ||
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully. | ||
* | ||
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines | ||
* behave as closely as possible to ECMAScript 6 (Harmony). | ||
* | ||
* @version 1.1.0 | ||
* @version 1.1.1 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -50,12 +37,4 @@ * @copyright Xotic750 | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
/* eslint strict: 1 */ | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:3, maxcomplexity:2 */ | ||
/* eslint strict: 1, max-statements: 1 */ | ||
/* global module */ | ||
@@ -68,3 +47,2 @@ | ||
var $toString = require('to-string-x'); | ||
var pReplace = String.prototype.replace; | ||
var syntaxChars = /[\^$\\.*+?()[\]{}|]/g; | ||
@@ -84,4 +62,4 @@ | ||
module.exports = function regexpEscape(string) { | ||
return pReplace.call($toString(string), syntaxChars, '\\$&'); | ||
return $toString(string).replace(syntaxChars, '\\$&'); | ||
}; | ||
}()); |
@@ -24,22 +24,9 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.returnExports = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
* | ||
* regexpEscape module. | ||
* ECMAScript proposed RegExp.escape. | ||
* | ||
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2> | ||
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5 | ||
* methods that can be faithfully emulated with a legacy JavaScript engine. | ||
* Requires ES3 or above. | ||
* | ||
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible. | ||
* For these methods, as closely as possible to ES5 is not very close. | ||
* Many of these shams are intended only to allow code to be written to ES5 | ||
* without causing run-time errors in older engines. In many cases, | ||
* this means that these shams cause many ES5 methods to silently fail. | ||
* Decide carefully whether this is what you want. Note: es5-sham.js requires | ||
* es5-shim.js to be able to work properly. | ||
* @see {@link https://github.com/benjamingr/RegExp.escape|RegExp.escape} | ||
* | ||
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully. | ||
* | ||
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines | ||
* behave as closely as possible to ECMAScript 6 (Harmony). | ||
* | ||
* @version 1.1.0 | ||
* @version 1.1.1 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -51,12 +38,4 @@ * @copyright Xotic750 | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
/* eslint strict: 1 */ | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:3, maxcomplexity:2 */ | ||
/* eslint strict: 1, max-statements: 1 */ | ||
/* global module */ | ||
@@ -69,3 +48,2 @@ | ||
var $toString = _dereq_('to-string-x'); | ||
var pReplace = String.prototype.replace; | ||
var syntaxChars = /[\^$\\.*+?()[\]{}|]/g; | ||
@@ -85,7 +63,36 @@ | ||
module.exports = function regexpEscape(string) { | ||
return pReplace.call($toString(string), syntaxChars, '\\$&'); | ||
return $toString(string).replace(syntaxChars, '\\$&'); | ||
}; | ||
}()); | ||
},{"to-string-x":2}],2:[function(_dereq_,module,exports){ | ||
},{"to-string-x":3}],2:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
var toStr = Object.prototype.toString; | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; | ||
if (hasSymbols) { | ||
var symToStr = Symbol.prototype.toString; | ||
var symStringRegex = /^Symbol\(.*\)$/; | ||
var isSymbolObject = function isSymbolObject(value) { | ||
if (typeof value.valueOf() !== 'symbol') { return false; } | ||
return symStringRegex.test(symToStr.call(value)); | ||
}; | ||
module.exports = function isSymbol(value) { | ||
if (typeof value === 'symbol') { return true; } | ||
if (toStr.call(value) !== '[object Symbol]') { return false; } | ||
try { | ||
return isSymbolObject(value); | ||
} catch (e) { | ||
return false; | ||
} | ||
}; | ||
} else { | ||
module.exports = function isSymbol(value) { | ||
// this environment does not support Symbols. | ||
return false; | ||
}; | ||
} | ||
},{}],3:[function(_dereq_,module,exports){ | ||
/** | ||
@@ -113,22 +120,9 @@ * @file | ||
* | ||
* ToString module. | ||
* ES6-compliant shim for ToString. | ||
* | ||
* <h2>ECMAScript compatibility shims for legacy JavaScript engines</h2> | ||
* `es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5 | ||
* methods that can be faithfully emulated with a legacy JavaScript engine. | ||
* Requires ES3 or above. | ||
* | ||
* `es5-sham.js` monkey-patches other ES5 methods as closely as possible. | ||
* For these methods, as closely as possible to ES5 is not very close. | ||
* Many of these shams are intended only to allow code to be written to ES5 | ||
* without causing run-time errors in older engines. In many cases, | ||
* this means that these shams cause many ES5 methods to silently fail. | ||
* Decide carefully whether this is what you want. Note: es5-sham.js requires | ||
* es5-shim.js to be able to work properly. | ||
* @see {@link http://www.ecma-international.org/ecma-262/6.0/#sec-tostring|7.1.12 ToString ( argument )} | ||
* | ||
* `json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully. | ||
* | ||
* `es6.shim.js` provides compatibility shims so that legacy JavaScript engines | ||
* behave as closely as possible to ECMAScript 6 (Harmony). | ||
* | ||
* @version 1.1.0 | ||
* @version 1.1.2 | ||
* @author Xotic750 <Xotic750@gmail.com> | ||
@@ -140,12 +134,4 @@ * @copyright Xotic750 | ||
/* jslint maxlen:80, es6:true, white:true */ | ||
/* eslint strict: 1 */ | ||
/* jshint bitwise:true, camelcase:true, curly:true, eqeqeq:true, forin:true, | ||
freeze:true, futurehostile:true, latedef:true, newcap:true, nocomma:true, | ||
nonbsp:true, singleGroups:true, strict:true, undef:true, unused:true, | ||
es3:false, esnext:true, plusplus:true, maxparams:1, maxdepth:1, | ||
maxstatements:3, maxcomplexity:2 */ | ||
/* eslint strict: 1, max-statements: 1 */ | ||
/* global module */ | ||
@@ -157,3 +143,3 @@ | ||
var $String = String; | ||
var isSymbol = _dereq_('is-symbol'); | ||
@@ -179,10 +165,10 @@ /** | ||
module.exports = function ToString(value) { | ||
if (typeof value === 'symbol') { | ||
if (isSymbol(value)) { | ||
throw new TypeError('Cannot convert a Symbol value to a string'); | ||
} | ||
return $String(value); | ||
return String(value); | ||
}; | ||
}()); | ||
},{}]},{},[1])(1) | ||
},{"is-symbol":2}]},{},[1])(1) | ||
}); |
@@ -1,2 +0,2 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.returnExports=e()}}(function(){return function e(n,r,t){function s(i,f){if(!r[i]){if(!n[i]){var u="function"==typeof require&&require;if(!f&&u)return u(i,!0);if(o)return o(i,!0);var p=new Error("Cannot find module '"+i+"'");throw p.code="MODULE_NOT_FOUND",p}var c=r[i]={exports:{}};n[i][0].call(c.exports,function(e){var r=n[i][1][e];return s(r?r:e)},c,c.exports,e,n,r,t)}return r[i].exports}for(var o="function"==typeof require&&require,i=0;i<t.length;i++)s(t[i]);return s}({1:[function(e,n,r){!function(){"use strict";var r=e("to-string-x"),t=String.prototype.replace,o=/[\^$\\.*+?()[\]{}|]/g;n.exports=function regexpEscape(e){return t.call(r(e),o,"\\$&")}}()},{"to-string-x":2}],2:[function(e,n,r){!function(){"use strict";var e=String;n.exports=function ToString(n){if("symbol"==typeof n)throw new TypeError("Cannot convert a Symbol value to a string");return e(n)}}()},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.returnExports=e()}}(function(){return function e(t,o,r){function s(i,f){if(!o[i]){if(!t[i]){var u="function"==typeof require&&require;if(!f&&u)return u(i,!0);if(n)return n(i,!0);var l=new Error("Cannot find module '"+i+"'");throw l.code="MODULE_NOT_FOUND",l}var c=o[i]={exports:{}};t[i][0].call(c.exports,function(e){var o=t[i][1][e];return s(o?o:e)},c,c.exports,e,t,o,r)}return o[i].exports}for(var n="function"==typeof require&&require,i=0;i<r.length;i++)s(r[i]);return s}({1:[function(e,t,o){!function(){"use strict";var o=e("to-string-x");t.exports=function regexpEscape(e){return o(e).replace(/[\^$\\.*+?()[\]{}|]/g,"\\$&")}}()},{"to-string-x":3}],2:[function(e,t,o){"use strict";var r=Object.prototype.toString;if("function"==typeof Symbol&&"symbol"==typeof Symbol()){var n=Symbol.prototype.toString,i=/^Symbol\(.*\)$/,f=function isSymbolObject(e){return"symbol"==typeof e.valueOf()&&i.test(n.call(e))};t.exports=function isSymbol(e){if("symbol"==typeof e)return!0;if("[object Symbol]"!==r.call(e))return!1;try{return f(e)}catch(e){return!1}}}else t.exports=function isSymbol(e){return!1}},{}],3:[function(e,t,o){!function(){"use strict";var o=e("is-symbol");t.exports=function ToString(e){if(o(e))throw new TypeError("Cannot convert a Symbol value to a string");return String(e)}}()},{"is-symbol":2}]},{},[1])(1)}); | ||
//# sourceMappingURL=lib/regexp-escape-x.map |
{ | ||
"name": "regexp-escape-x", | ||
"version": "1.1.0", | ||
"description": "regexpEscape module.", | ||
"version": "1.1.1", | ||
"description": "ECMAScript proposed RegExp.escape.", | ||
"homepage": "https://github.com/Xotic750/regexp-escape-x", | ||
@@ -10,3 +10,3 @@ "author": { | ||
}, | ||
"copyright": "Copyright (c) 2015-2016", | ||
"copyright": "Copyright (c) 2015-2017", | ||
"keywords": [ | ||
@@ -36,25 +36,31 @@ "regexpEscape", | ||
"@ljharb/eslint-config": "^11.0.0", | ||
"browserify": "^14.1.0", | ||
"browserify-derequire": "^0.9.4", | ||
"es5-shim": "^4.5.9", | ||
"es6-shim": "^0.35.3", | ||
"es7-shim": "^6.0.0", | ||
"eslint": "^3.15.0", | ||
"eslint": "^3.18.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"json3": "^3.3.2", | ||
"jscs": "^3.0.7", | ||
"uglify-js": "^2.7.5", | ||
"browserify": "^14.1.0", | ||
"browserify-derequire": "^0.9.4", | ||
"jasmine-node": "^1.14.5", | ||
"jsdoc-to-markdown": "^3.0.0", | ||
"nsp": "^2.6.2" | ||
"json3": "^3.3.2", | ||
"make-jasmine-spec-runner-html": "^1.0.4", | ||
"nodemon": "^1.11.0", | ||
"nsp": "^2.6.3", | ||
"replace-x": "^1.0.0", | ||
"uglify-js": "^2.8.16" | ||
}, | ||
"scripts": { | ||
"build": "npm run build:setver && npm run security && npm run eslint && npm run browserify && npm run uglify && npm run docs && npm run build:jasmine && npm test", | ||
"build:jasmine": "make-jasmine-spec-runner-html", | ||
"build:setver": "PKG_VER=$(node -p -e \"require('./package.json').version\") && replace-x \" @version .*\" \" @version ${PKG_VER}\" index.js", | ||
"build:watch": "nodemon --watch index.js --watch package.json --exec 'npm run build'", | ||
"docs": "jsdoc2md --name-format --example-lang js index.js > README.md", | ||
"eslint": "eslint *.js tests/spec/*.js", | ||
"security": "nsp check", | ||
"test": "jasmine-node --matchall tests/spec/", | ||
"security": "nsp check", | ||
"style": "jscs index.js", | ||
"eslint": "eslint *.js tests/spec/*.js", | ||
"docs": "jsdoc2md --name-format --example-lang js index.js > README.md", | ||
"build": "browserify -p browserify-derequire -e index.js -o lib/regexp-escape-x.js -u 'crypto' -s returnExports", | ||
"build-uglify": "uglifyjs lib/regexp-escape-x.js -o lib/regexp-escape-x.min.js --compress --keep-fnames --mangle --beautify ascii_only=true,beautify=false --source-map lib/regexp-escape-x.map" | ||
"test:watch": "nodemon --watch tests/spec/test.js --exec 'npm test'", | ||
"browserify": "browserify -p browserify-derequire -e index.js -o lib/regexp-escape-x.js -u 'crypto' -s returnExports", | ||
"uglify": "uglifyjs lib/regexp-escape-x.js -o lib/regexp-escape-x.min.js --compress --keep-fnames --mangle --beautify ascii_only=true,beautify=false --source-map lib/regexp-escape-x.map" | ||
} | ||
} |
@@ -24,23 +24,9 @@ <a name="module_regexp-escape-x"></a> | ||
regexpEscape module. | ||
ECMAScript proposed RegExp.escape. | ||
<h2>ECMAScript compatibility shims for legacy JavaScript engines</h2> | ||
`es5-shim.js` monkey-patches a JavaScript context to contain all EcmaScript 5 | ||
methods that can be faithfully emulated with a legacy JavaScript engine. | ||
Requires ES3 or above. | ||
`es5-sham.js` monkey-patches other ES5 methods as closely as possible. | ||
For these methods, as closely as possible to ES5 is not very close. | ||
Many of these shams are intended only to allow code to be written to ES5 | ||
without causing run-time errors in older engines. In many cases, | ||
this means that these shams cause many ES5 methods to silently fail. | ||
Decide carefully whether this is what you want. Note: es5-sham.js requires | ||
es5-shim.js to be able to work properly. | ||
`json3.js` monkey-patches the EcmaScript 5 JSON implimentation faithfully. | ||
`es6.shim.js` provides compatibility shims so that legacy JavaScript engines | ||
behave as closely as possible to ECMAScript 6 (Harmony). | ||
**Version**: 1.1.0 | ||
**Author:** Xotic750 <Xotic750@gmail.com> | ||
**See**: [RegExp.escape](https://github.com/benjamingr/RegExp.escape) | ||
**Version**: 1.1.1 | ||
**Author**: Xotic750 <Xotic750@gmail.com> | ||
**License**: [MIT](<https://opensource.org/licenses/MIT>) | ||
@@ -47,0 +33,0 @@ **Copyright**: Xotic750 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22299
16
13
315
52