@caidrive/shared
Version:
caidrive.shared.components
45 lines (44 loc) • 1.09 kB
JavaScript
;
/**
* What it does.
*
* @param name - Parameter description.
* @returns Type and description of the returned object.
*
* @example
* ```
* Write me later.
* ```
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextUtils = void 0;
const jsdom_1 = require("jsdom");
const dompurify_1 = __importDefault(require("dompurify"));
const { window } = new jsdom_1.JSDOM("<!DOCTYPE html>");
const dompurify = (0, dompurify_1.default)(window);
class TextUtils {
/**
*
*/
static sanitize(text) {
return dompurify.sanitize(text);
}
/**
*
*/
static capitalize(text) {
/**
*
*/
if (text !== undefined && text.length > 0) {
const first = text.charAt(0).toUpperCase();
const rest = text.slice(1).toLowerCase();
return first + rest;
}
return text;
}
}
exports.TextUtils = TextUtils;