| "use strict"; |
| Object.defineProperty(exports, "__esModule", { value: true }); |
| exports.isCheerio = isCheerio; |
| exports.camelCase = camelCase; |
| exports.cssCase = cssCase; |
| exports.domEach = domEach; |
| exports.isHtml = isHtml; |
| |
| |
| |
| |
| |
| |
| |
| function isCheerio(maybeCheerio) { |
| return maybeCheerio.cheerio != null; |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| function camelCase(str) { |
| return str.replace(/[._-](\w|$)/g, (_, x) => x.toUpperCase()); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function cssCase(str) { |
| return str.replace(/[A-Z]/g, '-$&').toLowerCase(); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function domEach(array, fn) { |
| const len = array.length; |
| for (let i = 0; i < len; i++) |
| fn(array[i], i); |
| return array; |
| } |
| var CharacterCodes; |
| (function (CharacterCodes) { |
| CharacterCodes[CharacterCodes["LowerA"] = 97] = "LowerA"; |
| CharacterCodes[CharacterCodes["LowerZ"] = 122] = "LowerZ"; |
| CharacterCodes[CharacterCodes["UpperA"] = 65] = "UpperA"; |
| CharacterCodes[CharacterCodes["UpperZ"] = 90] = "UpperZ"; |
| CharacterCodes[CharacterCodes["Exclamation"] = 33] = "Exclamation"; |
| })(CharacterCodes || (CharacterCodes = {})); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function isHtml(str) { |
| const tagStart = str.indexOf('<'); |
| if (tagStart < 0 || tagStart > str.length - 3) |
| return false; |
| const tagChar = str.charCodeAt(tagStart + 1); |
| return (((tagChar >= CharacterCodes.LowerA && tagChar <= CharacterCodes.LowerZ) || |
| (tagChar >= CharacterCodes.UpperA && tagChar <= CharacterCodes.UpperZ) || |
| tagChar === CharacterCodes.Exclamation) && |
| str.includes('>', tagStart + 2)); |
| } |
| |