Files
oneuptime/Common/Types/Html.ts
Nawaz Dhandala 6d5bc111ba Refactor comments across multiple files to improve clarity and consistency
- Updated comments in Probe/Config.ts to use block comments for proxy configuration.
- Refactored comments in PortMonitor.ts, SyntheticMonitor.ts, and OnlineCheck.ts to block comments for better readability.
- Adjusted comments in ProbeIngest/API/Monitor.ts and ProbeIngest/API/Probe.ts to block comments for clarity.
- Standardized comments in various data migration scripts to block comments for consistency.
- Modified eslint.config.js to enforce multiline comment style as an error.
2025-10-02 11:53:55 +01:00

31 lines
709 B
TypeScript

export default class HTML {
private _html: string = "";
public get html(): string {
return this._html;
}
public set html(v: string) {
this._html = v;
}
public constructor(html: string) {
this.html = html;
}
public toString(): string {
return this.html;
}
public static isHtml(text: string): boolean {
// Check if the text is HTML
/*
* Example usage const htmlString = '<div>Hello, World!</div>'; const notHtmlString = 'Just a regular string'
* console.log(HTML.isHtml(htmlString)); // true
* console.log(HTML.isHtml(notHtmlString)); // false
*/
const htmlPattern: RegExp = /<\/?[a-z][\s\S]*>/i;
return htmlPattern.test(text);
}
}