diff --git a/html-entities/html-entities-tests.ts b/html-entities/html-entities-tests.ts new file mode 100644 index 000000000..d9c4f76ce --- /dev/null +++ b/html-entities/html-entities-tests.ts @@ -0,0 +1,10 @@ +/// + +import * as htmlEntities from "html-entities"; + +let entities = new htmlEntities.AllHtmlEntities(); + +console.log(entities.encode('<>"\'&©®')); // <>"'&©® +console.log(entities.encodeNonUTF('<>"\'&©®')); // <>"'&©® +console.log(entities.encodeNonASCII('<>"\'&©®')); // <>"\'&©® +console.log(entities.decode('<>"'&©®∆')); // <>"'&©®∆ \ No newline at end of file diff --git a/html-entities/html-entities.d.ts b/html-entities/html-entities.d.ts new file mode 100644 index 000000000..1539b0c4d --- /dev/null +++ b/html-entities/html-entities.d.ts @@ -0,0 +1,17 @@ +// Type definitions for html-entities v1.2.0 +// Project: https://www.npmjs.com/package/html-entities +// Definitions by: Xavier Stouder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "html-entities" { + abstract class Entities { + encode(toEncode: string): string; + encodeNonUTF(toEncode: string): string; + encodeNonASCII(toEncode: string): string; + decode(toDecode: string): string; + } + class XmlEntities extends Entities {} + class Html4Entities extends Entities {} + class Html5Entities extends Entities {} + class AllHtmlEntities extends Entities {} +} \ No newline at end of file