mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Reduce _.escape and _.unescape dependencies
This commit is contained in:
52
dist/lodash.underscore.js
vendored
52
dist/lodash.underscore.js
vendored
@@ -26,6 +26,10 @@
|
||||
reEvaluate = /<%([\s\S]+?)%>/g,
|
||||
reInterpolate = /<%=([\s\S]+?)%>/g;
|
||||
|
||||
/** Used to match HTML entities and HTML characters */
|
||||
var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
|
||||
reUnescapedHtml = /[&<>"']/g;
|
||||
|
||||
/** Used to ensure capturing order of template delimiters */
|
||||
var reNoMatch = /($^)/;
|
||||
|
||||
@@ -43,6 +47,31 @@
|
||||
regexpClass = '[object RegExp]',
|
||||
stringClass = '[object String]';
|
||||
|
||||
/**
|
||||
* Used to convert characters to HTML entities:
|
||||
*
|
||||
* Though the `>` character is escaped for symmetry, characters like `>` and `/`
|
||||
* don't require escaping in HTML and have no special meaning unless they're part
|
||||
* of a tag or an unquoted attribute value.
|
||||
* http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
|
||||
*/
|
||||
var htmlEscapes = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
};
|
||||
|
||||
/** Used to convert HTML entities to characters */
|
||||
var htmlUnescapes = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
''': "'"
|
||||
};
|
||||
|
||||
/** Used to determine if values are of the language type Object */
|
||||
var objectTypes = {
|
||||
'boolean': false,
|
||||
@@ -983,29 +1012,6 @@
|
||||
return nativeKeys(object);
|
||||
};
|
||||
|
||||
/**
|
||||
* Used to convert characters to HTML entities:
|
||||
*
|
||||
* Though the `>` character is escaped for symmetry, characters like `>` and `/`
|
||||
* don't require escaping in HTML and have no special meaning unless they're part
|
||||
* of a tag or an unquoted attribute value.
|
||||
* http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
|
||||
*/
|
||||
var htmlEscapes = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
};
|
||||
|
||||
/** Used to convert HTML entities to characters */
|
||||
var htmlUnescapes = invert(htmlEscapes);
|
||||
|
||||
/** Used to match HTML entities and HTML characters */
|
||||
var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'),
|
||||
reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g');
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user