MCPcopy Index your code
hub / github.com/getsentry/sentry / hasJsxAttribute

Method hasJsxAttribute

scripts/extractFormFields.ts:328–342  ·  view source on GitHub ↗

Returns true if the JSX element has an attribute with the given name, regardless of its value.

(
    node: ts.JsxElement | ts.JsxSelfClosingElement,
    attributeName: string
  )

Source from the content-addressed store, hash-verified

326
327 /** Returns true if the JSX element has an attribute with the given name, regardless of its value. */
328 private hasJsxAttribute(
329 node: ts.JsxElement | ts.JsxSelfClosingElement,
330 attributeName: string
331 ): boolean {
332 const attributes = ts.isJsxElement(node)
333 ? node.openingElement.attributes
334 : node.attributes;
335
336 return attributes.properties.some(
337 attr =>
338 ts.isJsxAttribute(attr) &&
339 ts.isIdentifier(attr.name) &&
340 attr.name.text === attributeName
341 );
342 }
343
344 /**
345 * Get the string value of a JSX attribute (extracts from t() calls)

Callers 1

visitMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected