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

Method toLiteral

packages/compiler-cli/linker/src/ast/ast_value.ts:176–187  ·  view source on GitHub ↗

* Converts the AstObject to a raw JavaScript object, mapping each property value (as an * `AstValue`) to the generic type (`T`) via the `mapper` function.

(
    mapper: (value: AstValue<ObjectValueType<T>, TExpression>, key: string) => V,
  )

Source from the content-addressed store, hash-verified

174 * `AstValue`) to the generic type (`T`) via the `mapper` function.
175 */
176 toLiteral<V>(
177 mapper: (value: AstValue<ObjectValueType<T>, TExpression>, key: string) => V,
178 ): Record<string, V> {
179 const result: Record<string, V> = {};
180 for (const [key, expression] of this.obj) {
181 result[key] = mapper(
182 new AstValue<ObjectValueType<T>, TExpression>(expression, this.host),
183 key,
184 );
185 }
186 return result;
187 }
188
189 /**
190 * Converts the AstObject to a JavaScript Map, mapping each property value (as an

Callers 3

ast_value_spec.tsFile · 0.80
toR3DirectiveMetaFunction · 0.80
toHostMetadataFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected