MCPcopy
hub / github.com/webpack/webpack / internLowerName

Function internLowerName

lib/html/syntax.js:4553–4572  ·  view source on GitHub ↗
(table, input, start, end)

Source from the content-addressed store, hash-verified

4551 * @returns {string} lowercased name
4552 */
4553const internLowerName = (table, input, start, end) => {
4554 let h = end - start;
4555 for (let i = start; i < end; i++) {
4556 let c = input.charCodeAt(i);
4557 if (c >= 0x41 && c <= 0x5a) c += 0x20;
4558 h = ((h << 5) - h + c) | 0;
4559 }
4560 const hit = table.get(h);
4561 if (hit !== undefined) {
4562 if (typeof hit === "string") {
4563 if (rangeEqualsLower(input, start, end, hit)) return hit;
4564 } else {
4565 for (let i = 0; i < hit.length; i++) {
4566 if (rangeEqualsLower(input, start, end, hit[i])) return hit[i];
4567 }
4568 }
4569 }
4570 // Unknown name (custom element, data-* attribute, non-ASCII, …).
4571 return input.slice(start, end).toLowerCase();
4572};
4573
4574// Every tag name the tree builder compares against (the sets above already
4575// cover most of the spec), plus the remaining standard/foreign names so

Callers 1

buildHtmlAstFunction · 0.85

Calls 3

rangeEqualsLowerFunction · 0.85
sliceMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected