Create html-entities definitions file (#8890)

* Create html-entities definitions file

* Fix Travis test
This commit is contained in:
Xavier Stouder
2016-04-12 22:43:57 +09:00
committed by Masahiro Wakame
parent 0ea6c46516
commit 883f016ef7
2 changed files with 27 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
/// <reference path="html-entities.d.ts" />
import * as htmlEntities from "html-entities";
let entities = new htmlEntities.AllHtmlEntities();
console.log(entities.encode('<>"\'&©®')); // &lt;&gt;&quot;&apos;&amp;©®
console.log(entities.encodeNonUTF('<>"\'&©®')); // &lt;&gt;&quot;&apos;&amp;&#169;&#174;
console.log(entities.encodeNonASCII('<>"\'&©®')); // <>"\'&©®
console.log(entities.decode('&lt;&gt;&quot;&apos;&amp;&copy;&reg;&#8710;')); // <>"'&&copy;&reg;∆
+17
View File
@@ -0,0 +1,17 @@
// Type definitions for html-entities v1.2.0
// Project: https://www.npmjs.com/package/html-entities
// Definitions by: Xavier Stouder <https://github.com/xstoudi/>
// 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 {}
}