@canvacord/assets
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -7,3 +7,6 @@ declare class AssetManager { | ||
load(): Promise<void>; | ||
clear(): void; | ||
get(name: string): string; | ||
set(name: string, data: string): string; | ||
get size(): number; | ||
} | ||
@@ -10,0 +13,0 @@ declare const _default: { |
@@ -23,13 +23,25 @@ "use strict"; | ||
load() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const files = yield fs_1.promises.readdir(this.dir); | ||
for (const file of files) { | ||
const name = file.split(".")[0]; | ||
const name = (_a = file.split(".").shift()) !== null && _a !== void 0 ? _a : file; | ||
this.data[name] = `${this.dir}/${file}`; | ||
} | ||
this.loaded = true; | ||
}); | ||
} | ||
clear() { | ||
this.data = {}; | ||
this.loaded = false; | ||
} | ||
get(name) { | ||
return this.data[name]; | ||
} | ||
set(name, data) { | ||
return this.data[name] = data; | ||
} | ||
get size() { | ||
return Object.keys(this.data).length; | ||
} | ||
} | ||
@@ -36,0 +48,0 @@ module.exports = { |
{ | ||
"name": "@canvacord/assets", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Assets used in Canvacord", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7311237
72