Remove semicolons.

This commit is contained in:
John-David Dalton
2017-02-04 23:50:10 -08:00
parent f3a8e55e70
commit 6cb3460fce
452 changed files with 4261 additions and 4261 deletions

View File

@@ -1,17 +1,17 @@
import toString from './toString.js';
import toString from './toString.js'
/** Used to map characters to HTML entities. */
const htmlEscapes = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;'
};
'&': '&amp',
'<': '&lt',
'>': '&gt',
'"': '&quot',
"'": '&#39'
}
/** 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, &amp; pebbles'
* escape('fred, barney, & pebbles')
* // => 'fred, barney, &amp 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