MCPcopy Create free account
hub / github.com/angular/components / indentTextContent

Function indentTextContent

src/cdk/schematics/utils/build-component.ts:140–144  ·  view source on GitHub ↗

* Indents the text content with the amount of specified spaces. The spaces will be added after * every line-break. This utility function can be used inside of EJS templates to properly * include the additional files.

(text: string, numSpaces: number)

Source from the content-addressed store, hash-verified

138 * include the additional files.
139 */
140function indentTextContent(text: string, numSpaces: number): string {
141 // In the Material project there should be only LF line-endings, but the schematic files
142 // are not being linted and therefore there can be also CRLF or just CR line-endings.
143 return text.replace(/(\r\n|\r|\n)/g, `$1${' '.repeat(numSpaces)}`);
144}
145
146/**
147 * Rule that copies and interpolates the files that belong to this schematic context. Additionally

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected