20 lines
449 B
TypeScript
20 lines
449 B
TypeScript
|
import {Converter} from "./converter";
|
||
|
|
||
|
export class HTMLEntitiesEncoder implements Converter {
|
||
|
getDisplayname():string {
|
||
|
return "Encode HTML entities";
|
||
|
}
|
||
|
|
||
|
getId():string {
|
||
|
return "encodehtmlentities";
|
||
|
}
|
||
|
|
||
|
convert(input:string):string {
|
||
|
return input
|
||
|
.replace(/\&/g, "&")
|
||
|
.replace(/\</g, "<")
|
||
|
.replace(/\>/g, ">")
|
||
|
.replace(/\"/g, """);
|
||
|
}
|
||
|
}
|