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

Function bloomHashBitOrFactory

packages/core/src/render3/di.ts:825–847  ·  view source on GitHub ↗
(
  token: ProviderToken<any> | string,
)

Source from the content-addressed store, hash-verified

823 * When the returned value is negative then it represents special values such as `Injector`.
824 */
825export function bloomHashBitOrFactory(
826 token: ProviderToken<any> | string,
827): number | Function | undefined {
828 ngDevMode && assertDefined(token, 'token must be defined');
829 if (typeof token === 'string') {
830 return token.charCodeAt(0) || 0;
831 }
832 const tokenId: number | undefined =
833 // First check with `hasOwnProperty` so we don't get an inherited ID.
834 token.hasOwnProperty(NG_ELEMENT_ID) ? (token as any)[NG_ELEMENT_ID] : undefined;
835 // Negative token IDs are used for special objects such as `Injector`
836 if (typeof tokenId === 'number') {
837 if (tokenId >= 0) {
838 return tokenId & BLOOM_MASK;
839 } else {
840 ngDevMode &&
841 assertEqual(tokenId, InjectorMarkers.Injector, 'Expecting to get Special Injector Id');
842 return createNodeInjector;
843 }
844 } else {
845 return tokenId;
846 }
847}
848
849export function bloomHasToken(
850 bloomHash: number,

Callers 1

Calls 2

assertDefinedFunction · 0.90
assertEqualFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…