MCPcopy
hub / github.com/webpack/webpack / findAttr

Function findAttr

lib/html/syntax.js:4611–4619  ·  view source on GitHub ↗
(
	/** @type {HtmlAttribute[]} */ attrs,
	/** @type {string} */ name
)

Source from the content-addressed store, hash-verified

4609// Linear attribute lookup by name — avoids the per-call arrow `Array#find`
4610// would allocate (attribute lists are short, so a plain loop is faster too).
4611const findAttr = (
4612 /** @type {HtmlAttribute[]} */ attrs,
4613 /** @type {string} */ name
4614) => {
4615 for (let i = 0; i < attrs.length; i++) {
4616 if (attrs[i].name === name) return attrs[i];
4617 }
4618 return undefined;
4619};
4620
4621/**
4622 * @param {string} source HTML source

Callers 4

htmlIntegrationPointFunction · 0.85
startTagInBodyFunction · 0.85
buildHtmlAstFunction · 0.85
parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected