* 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)
| 442 | * @param tStylingKey |
| 443 | */ |
| 444 | function 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 | } |
no test coverage detected
searching dependent graphs…