Remove toString coercion method use.

This commit is contained in:
John-David Dalton
2017-03-14 23:27:37 -07:00
parent 351e44a127
commit b8a3a42278
16 changed files with 9 additions and 45 deletions

View File

@@ -1,5 +1,3 @@
import toString from './toString.js'
/** Used to map characters to HTML entities. */
const htmlEscapes = {
'&': '&amp',
@@ -41,7 +39,6 @@ const reHasUnescapedHtml = RegExp(reUnescapedHtml.source)
* // => 'fred, barney, &amp pebbles'
*/
function escape(string) {
string = toString(string)
return (string && reHasUnescapedHtml.test(string))
? string.replace(reUnescapedHtml, (chr) => htmlEscapes[chr])
: string