mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Remove semicolons.
This commit is contained in:
28
escape.js
28
escape.js
@@ -1,17 +1,17 @@
|
||||
import toString from './toString.js';
|
||||
import toString from './toString.js'
|
||||
|
||||
/** Used to map characters to HTML entities. */
|
||||
const htmlEscapes = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
};
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
}
|
||||
|
||||
/** Used to match HTML entities and HTML characters. */
|
||||
const reUnescapedHtml = /[&<>"']/g;
|
||||
const reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
||||
const reUnescapedHtml = /[&<>"']/g
|
||||
const reHasUnescapedHtml = RegExp(reUnescapedHtml.source)
|
||||
|
||||
/**
|
||||
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their
|
||||
@@ -37,14 +37,14 @@ const reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
||||
* @see escapeRegExp, unescape
|
||||
* @example
|
||||
*
|
||||
* escape('fred, barney, & pebbles');
|
||||
* // => 'fred, barney, & pebbles'
|
||||
* escape('fred, barney, & pebbles')
|
||||
* // => 'fred, barney, & pebbles'
|
||||
*/
|
||||
function escape(string) {
|
||||
string = toString(string);
|
||||
string = toString(string)
|
||||
return (string && reHasUnescapedHtml.test(string))
|
||||
? string.replace(reUnescapedHtml, chr => htmlEscapes[chr])
|
||||
: string;
|
||||
: string
|
||||
}
|
||||
|
||||
export default escape;
|
||||
export default escape
|
||||
|
||||
Reference in New Issue
Block a user