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

Function toOptionalLiteralMap

packages/compiler/src/render3/partial/util.ts:42–56  ·  view source on GitHub ↗
(
  object: {[key: string]: T},
  mapper: (value: T) => o.Expression,
)

Source from the content-addressed store, hash-verified

40 * any keys.
41 */
42export function toOptionalLiteralMap<T>(
43 object: {[key: string]: T},
44 mapper: (value: T) => o.Expression,
45): o.LiteralMapExpr | null {
46 const entries = Object.keys(object).map((key) => {
47 const value = object[key];
48 return {key, value: mapper(value), quoted: true};
49 });
50
51 if (entries.length > 0) {
52 return o.literalMap(entries);
53 } else {
54 return null;
55 }
56}
57
58export function compileDependencies(
59 deps: R3DependencyMetadata[] | 'invalid' | null,

Callers 1

compileHostMetadataFunction · 0.90

Calls 2

mapMethod · 0.80
keysMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…