mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-10-24 08:33:36 +00:00
26 lines
473 B
TypeScript
26 lines
473 B
TypeScript
'use strict';
|
|
|
|
let instance: null | CommonUtil = null;
|
|
|
|
class CommonUtil {
|
|
constructor() {
|
|
if (instance) {
|
|
return instance;
|
|
} else {
|
|
instance = this;
|
|
}
|
|
return instance;
|
|
}
|
|
|
|
// unescape already encoded/escaped strings
|
|
decodeString(stringInput: string): string {
|
|
const parser = new DOMParser();
|
|
const dom = parser.parseFromString(
|
|
'<!doctype html><body>' + stringInput,
|
|
'text/html');
|
|
return dom.body.textContent;
|
|
}
|
|
}
|
|
|
|
export = new CommonUtil();
|