"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Utils = void 0;
var Utils = (function () {
    function Utils() {
    }
    Utils.extractIdFromDataFormat = function (df) {
        if (df == null)
            return null;
        return Number.isInteger(df) ? df : df.id;
    };
    Utils.hasDecimals = function (val) {
        return val - Math.round(val) !== 0;
    };
    Utils.isNullOrEmpty = function (str) {
        return str == null || str.trim().length == 0;
    };
    Utils.isNotEmpty = function (str) {
        return false == this.isNullOrEmpty(str);
    };
    Utils.arrayHasDuplicates = function (array) {
        return array.some(function (item, index) { return array.indexOf(item) !== index; });
    };
    Utils.bodyFromHTML = function (html) {
        if (html != null && typeof (html) == 'string' && (html.includes('html') || html.includes('body') || html.includes('head'))) {
            var str = html;
            if (str.includes("<head>")) {
                str = str.slice(str.lastIndexOf('</head>') + "</head>".length).trimStart();
            }
            return new DOMParser().parseFromString(str, 'text/html').body;
        }
        return { innerText: html, innerHTML: html };
    };
    Utils.innerTextFromHTML = function (html) {
        return this.bodyFromHTML(html).innerText;
    };
    Utils.innerHTMLFromHTML = function (html) {
        return this.bodyFromHTML(html).innerHTML;
    };
    return Utils;
}());
exports.Utils = Utils;

//# sourceMappingURL=utils.js.map
