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

Method apply

packages/schematics/angular/utility/change.ts:125–138  ·  view source on GitHub ↗
(host: Host)

Source from the content-addressed store, hash-verified

123 }
124
125 apply(host: Host): Promise<void> {
126 return host.read(this.path).then((content) => {
127 const prefix = content.substring(0, this.pos);
128 const suffix = content.substring(this.pos + this.oldText.length);
129 const text = content.substring(this.pos, this.pos + this.oldText.length);
130
131 if (text !== this.oldText) {
132 return Promise.reject(new Error(`Invalid replace: "${text}" != "${this.oldText}".`));
133 }
134
135 // TODO: throw error if oldText doesn't match removed string.
136 return host.write(this.path, `${prefix}${this.newText}${suffix}`);
137 });
138 }
139}
140
141export function applyToUpdateRecorder(recorder: UpdateRecorder, changes: Change[]): void {

Callers

nothing calls this directly

Calls 2

readMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected