MCPcopy Index your code
hub / github.com/angular/angular / isStylingMatch

Function isStylingMatch

packages/core/src/render3/styling/style_binding_list.ts:444–465  ·  view source on GitHub ↗

* Determines if two `TStylingKey`s are a match. * * When computing whether a binding contains a duplicate, we need to compare if the instruction * `TStylingKey` has a match. * * Here are examples of `TStylingKey`s which match given `tStylingKeyCursor` is: * - `color` * - `color` // Matc

(tStylingKeyCursor: TStylingKey, tStylingKey: TStylingKeyPrimitive)

Source from the content-addressed store, hash-verified

442 * @param tStylingKey
443 */
444function isStylingMatch(tStylingKeyCursor: TStylingKey, tStylingKey: TStylingKeyPrimitive) {
445 ngDevMode &&
446 assertNotEqual(
447 Array.isArray(tStylingKey),
448 true,
449 "Expected that 'tStylingKey' has been unwrapped",
450 );
451 if (
452 tStylingKeyCursor === null || // If the cursor is `null` it means that we have map at that
453 // location so we must assume that we have a match.
454 tStylingKey == null || // If `tStylingKey` is `null` then it is a map therefor assume that it
455 // contains a match.
456 (Array.isArray(tStylingKeyCursor) ? tStylingKeyCursor[1] : tStylingKeyCursor) === tStylingKey // If the keys match explicitly than we are a match.
457 ) {
458 return true;
459 } else if (Array.isArray(tStylingKeyCursor) && typeof tStylingKey === 'string') {
460 // if we did not find a match, but `tStylingKeyCursor` is `KeyValueArray` that means cursor has
461 // statics and we need to check those as well.
462 return keyValueArrayIndexOf(tStylingKeyCursor, tStylingKey) >= 0; // see if we are matching the key
463 }
464 return false;
465}

Callers 1

markDuplicatesFunction · 0.85

Calls 3

assertNotEqualFunction · 0.90
keyValueArrayIndexOfFunction · 0.90
isArrayMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…