5 lines
310 B
JavaScript
5 lines
310 B
JavaScript
import assertString from './util/assertString';
|
|
export default function escape(str) {
|
|
assertString(str);
|
|
return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>').replace(/\//g, '/').replace(/\\/g, '\').replace(/`/g, '`');
|
|
} |