"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.encode = void 0;
const convertMatchToSpaces = (match) => " ".repeat(match.length);
/**
* Encode html string, leave only javascript code, replace other html code with whitespace.
* @param str {string} html string
* @returns {string} encoded string
*/
function encode(str) {
return str
.replace(/<\/script>.*?<script.*?>/gis, convertMatchToSpaces)
.replace(/^.*?<script.*?>/is, convertMatchToSpaces)
.replace(/<\/script>.*?$/is, convertMatchToSpaces);
}
exports.encode = encode;