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

Function applyChanges

packages/schematics/angular/utility/ast-utils_spec.ts:28–40  ·  view source on GitHub ↗
(path: string, content: string, changes: Change[])

Source from the content-addressed store, hash-verified

26}
27
28function applyChanges(path: string, content: string, changes: Change[]): string {
29 const tree = new HostTree();
30 tree.create(path, content);
31 const exportRecorder = tree.beginUpdate(path);
32 for (const change of changes) {
33 if (change instanceof InsertChange) {
34 exportRecorder.insertLeft(change.pos, change.toAdd);
35 }
36 }
37 tree.commitUpdate(exportRecorder);
38
39 return tree.readText(path);
40}
41
42describe('ast utils', () => {
43 let modulePath: string;

Callers 1

ast-utils_spec.tsFile · 0.85

Calls 5

createMethod · 0.95
beginUpdateMethod · 0.95
commitUpdateMethod · 0.95
readTextMethod · 0.95
insertLeftMethod · 0.65

Tested by

no test coverage detected