MCPcopy Create free account
hub / github.com/angular/angular / countBindings

Function countBindings

packages/core/src/render3/i18n/i18n_parse.ts:479–489  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

477 * contain multiple i18n bound attributes, it seems like this is a reasonable compromise.
478 */
479function countBindings(opCodes: I18nUpdateOpCodes): number {
480 let count = 0;
481 for (let i = 0; i < opCodes.length; i++) {
482 const opCode = opCodes[i];
483 // Bindings are negative numbers.
484 if (typeof opCode === 'number' && opCode < 0) {
485 count++;
486 }
487 }
488 return count;
489}
490
491/**
492 * Convert binding index to mask bit.

Callers 1

i18nAttributesFirstPassFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected