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

Function countBindings

packages/core/src/render3/i18n/i18n_parse.ts:490–500  ·  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

488 * contain multiple i18n bound attributes, it seems like this is a reasonable compromise.
489 */
490function 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.

Callers 1

i18nAttributesFirstPassFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected