UNPKG

canonical

Version:

Canonical code style linter and formatter for JavaScript, SCSS, CSS and JSON.

15 lines (12 loc) 282 B
var escape = module.exports = function escape(string) { return string.replace(/([&"<>'])/g, function(str, item) { return escape.map[item]; }) } var map = escape.map = { '>': '&gt;' , '<': '&lt;' , "'": '&apos;' , '"': '&quot;' , '&': '&amp;' }