MCPcopy
hub / github.com/angular/angular / stringify

Function stringify

packages/core/src/util/stringify.ts:9–35  ·  view source on GitHub ↗
(token: any)

Source from the content-addressed store, hash-verified

7 */
8
9export function stringify(token: any): string {
10 if (typeof token === 'string') {
11 return token;
12 }
13
14 if (Array.isArray(token)) {
15 return `[${token.map(stringify).join(', ')}]`;
16 }
17
18 if (token == null) {
19 return '' + token;
20 }
21
22 const name = token.overriddenName || token.name;
23 if (name) {
24 return `${name}`;
25 }
26
27 const result = token.toString();
28
29 if (result == null) {
30 return '' + result;
31 }
32
33 const newLineIndex = result.indexOf('\n');
34 return newLineIndex >= 0 ? result.slice(0, newLineIndex) : result;
35}
36
37/**
38 * Concatenates two strings with separator, allocating new strings only when necessary.

Callers 15

icrAsStringFunction · 0.90
kvcrAsStringFunction · 0.90
stringify_spec.tsFile · 0.90
walkProviderTreeFunction · 0.90
injectInjectorOnlyFunction · 0.90
forwardRefFunction · 0.90
getMethod · 0.90
toStringMethod · 0.90

Calls 5

isArrayMethod · 0.80
mapMethod · 0.80
indexOfMethod · 0.80
joinMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…