Skip to content

Commit b960ce5

Browse files
authored
Merge pull request #7 from cto-af/cleanup
Clean up recursive calls slightly
2 parents 771c371 + b218261 commit b960ce5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,10 @@ export class MonoRoot extends PackageFile {
316316
* @returns Promise of this, for chaining.
317317
*/
318318
public async save(gitAdd = false): Promise<this> {
319-
super.save(gitAdd);
320319
for (const p of this) {
321-
if (p !== this) {
320+
if (p === this) {
321+
super.save(gitAdd);
322+
} else {
322323
await p.save(gitAdd);
323324
}
324325
}
@@ -332,9 +333,10 @@ export class MonoRoot extends PackageFile {
332333
* @returns Promise of this, for chaining.
333334
*/
334335
public delete(fields: string[]): this {
335-
super.delete(fields);
336336
for (const p of this) {
337-
if (p !== this) {
337+
if (p === this) {
338+
super.delete(fields);
339+
} else {
338340
p.delete(fields);
339341
}
340342
}

0 commit comments

Comments
 (0)