* Count the number of bindings in the given `opCodes`. * * It could be possible to speed this up, by passing the number of bindings found back from * `generateBindingUpdateOpCodes()` to `i18nAttributesFirstPass()` but this would then require more * complexity in the code and/or transient objects
(opCodes: I18nUpdateOpCodes)
| 488 | * contain multiple i18n bound attributes, it seems like this is a reasonable compromise. |
| 489 | */ |
| 490 | function countBindings(opCodes: I18nUpdateOpCodes): number { |
| 491 | let count = 0; |
| 492 | for (let i = 0; i < opCodes.length; i++) { |
| 493 | const opCode = opCodes[i]; |
| 494 | // Bindings are negative numbers. |
| 495 | if (typeof opCode === 'number' && opCode < 0) { |
| 496 | count++; |
| 497 | } |
| 498 | } |
| 499 | return count; |
| 500 | } |
| 501 | |
| 502 | /** |
| 503 | * Convert binding index to mask bit. |
no outgoing calls
no test coverage detected