MCPcopy Index your code
hub / github.com/angular/angular-cli / forEach

Function forEach

packages/angular_devkit/schematics/src/rules/base.ts:127–150  ·  view source on GitHub ↗
(operator: FileOperator)

Source from the content-addressed store, hash-verified

125}
126
127export function forEach(operator: FileOperator): Rule {
128 return (tree: Tree) => {
129 tree.visit((path, entry) => {
130 if (!entry) {
131 return;
132 }
133 const newEntry = operator(entry);
134 if (newEntry === entry) {
135 return;
136 }
137 if (newEntry === null) {
138 tree.delete(path);
139
140 return;
141 }
142 if (newEntry.path != path) {
143 tree.rename(path, newEntry.path);
144 }
145 if (!newEntry.content.equals(entry.content)) {
146 tree.overwrite(newEntry.path, newEntry.content);
147 }
148 });
149 };
150}
151
152export function composeFileOperators(operators: FileOperator[]): FileOperator {
153 return (entry: FileEntry) => {

Callers 6

index.tsFile · 0.90
generateFromFilesFunction · 0.90
contentTemplateFunction · 0.90
pathTemplateFunction · 0.90
renameTemplateFilesFunction · 0.90
applyTemplatesFunction · 0.90

Calls 4

visitMethod · 0.65
deleteMethod · 0.65
renameMethod · 0.65
overwriteMethod · 0.65

Tested by

no test coverage detected