DefinitelyTyped/types/xml-escape/xml-escape-tests.ts
2019-05-14 14:55:43 -07:00

21 lines
426 B
TypeScript

/// <reference types="node" />
import xmlEscape = require("xml-escape");
const xml = `
<message>
<to>Barack Obama</to>
<from>Joe Biden</from>
<subject>Cats</subject>
<content>I freakin' love cats!!&!</content
</message>
`;
const fullEscaped = xmlEscape(xml); // $ExpectType string
const preservingApostrophe = xmlEscape(xml, "&"); // $ExpectType string
console.info({
fullEscaped,
preservingApostrophe
});