@bodar/totallylazy
Advanced tools
Comparing version 0.1.21 to 0.1.26
@@ -174,5 +174,5 @@ "use strict"; | ||
switch (_d.label) { | ||
case 0: return [4 /*yield*/, !this.exists]; | ||
case 0: return [4 /*yield*/, this.exists]; | ||
case 1: | ||
if (_d.sent()) | ||
if (!(_d.sent())) | ||
return [2 /*return*/, Promise.resolve()]; | ||
@@ -272,5 +272,4 @@ return [4 /*yield*/, this.isDirectory]; | ||
case 18: | ||
if (_d.sent()) { | ||
if (_d.sent()) | ||
destination = destination.child(this.name); | ||
} | ||
return [4 /*yield*/, util_1.promisify(fs.copyFile)(this.absolutePath, destination.absolutePath, flags)]; | ||
@@ -277,0 +276,0 @@ case 19: return [2 /*return*/, _d.sent()]; |
@@ -66,2 +66,15 @@ "use strict"; | ||
}); }); | ||
it('can tell if file exists', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var _a; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = chai_1.assert; | ||
return [4 /*yield*/, new files_1.File('some-random-file-that-does-not-exist').exists]; | ||
case 1: | ||
_a.apply(void 0, [!(_b.sent())]); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }); | ||
it('can list descendants', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
@@ -68,0 +81,0 @@ var _a, _b, child, e_2_1, e_2, _c; |
@@ -24,2 +24,6 @@ import {assert} from 'chai'; | ||
it('can tell if file exists', async () => { | ||
assert(!await new File('some-random-file-that-does-not-exist').exists); | ||
}); | ||
it('can list descendants', async () => { | ||
@@ -26,0 +30,0 @@ for await (const child of new File('src').descendants()) { |
15
files.ts
@@ -70,7 +70,5 @@ import * as fs from 'fs'; | ||
async delete(): Promise<void> { | ||
if (await !this.exists) return Promise.resolve(); | ||
if (!await this.exists) return Promise.resolve(); | ||
if (await this.isDirectory) { | ||
for await (const descendant of this.descendants()) { | ||
await descendant.delete(); | ||
} | ||
for await (const descendant of this.descendants()) await descendant.delete(); | ||
return await promisify(fs.rmdir)(this.absolutePath); | ||
@@ -85,10 +83,5 @@ } | ||
const dest = await destination.child(this.name).mkdir(); | ||
for await (const descendant of this.descendants()) { | ||
await descendant.copy(dest, flags); | ||
} | ||
for await (const descendant of this.descendants()) await descendant.copy(dest, flags); | ||
} else { | ||
if(await destination.isDirectory) { | ||
destination = destination.child(this.name); | ||
} | ||
if(await destination.isDirectory) destination = destination.child(this.name); | ||
return await promisify(fs.copyFile)(this.absolutePath, destination.absolutePath, flags); | ||
@@ -95,0 +88,0 @@ } |
{ | ||
"name": "@bodar/totallylazy", | ||
"version": "0.1.21", | ||
"version": "0.1.26", | ||
"description": "Totallylazy", | ||
@@ -34,2 +34,2 @@ "repository": "git@github.com:bodar/totallylazy.js.git", | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1587558
26803