user 6 rokov pred
rodič
commit
5c5378e6f5

+ 0 - 1
lib/storage-node.d.ts

@@ -4,7 +4,6 @@ export declare class StorageNode implements Storage {
     constructor(id: string);
     getValues(): Promise<unknown[]>;
     get(key: string): Promise<any>;
-    put(key: string, value: any): Promise<void>;
     set(key: string, value: any): Promise<void>;
     private getMap;
 }

+ 1 - 6
lib/storage-node.js

@@ -33,7 +33,7 @@ class StorageNode {
             return this.getMap()[key];
         });
     }
-    put(key, value) {
+    set(key, value) {
         return __awaiter(this, void 0, void 0, function* () {
             const filename = "data/storage_" + this.prefix;
             let map;
@@ -48,11 +48,6 @@ class StorageNode {
             fs.writeFileSync(filename, JSON.stringify(map));
         });
     }
-    set(key, value) {
-        return __awaiter(this, void 0, void 0, function* () {
-            return yield this.put(key, value);
-        });
-    }
     getMap() {
         try {
             const filename = "data/storage_" + this.prefix;

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 1
lib/storage-node.js.map


+ 0 - 1
lib/storage.d.ts

@@ -1,5 +1,4 @@
 export interface Storage {
     get(key: string): Promise<any>;
-    put(key: string, value: any): Promise<void>;
     set(key: string, value: any): Promise<void>;
 }

+ 1 - 5
src/storage-node.ts

@@ -27,7 +27,7 @@ export class StorageNode implements Storage {
         return this.getMap()[key];
     }
 
-    public async put(key:string, value:any) {
+    public async set(key:string, value:any) {
         const filename = "data/storage_" + this.prefix;
         let map;
         try {
@@ -40,10 +40,6 @@ export class StorageNode implements Storage {
         fs.writeFileSync(filename, JSON.stringify(map));
     }
 
-    public async set(key:string, value:any) {
-        return await this.put(key, value);
-    }
-
     private getMap() {
         try {
             const filename = "data/storage_" + this.prefix;

+ 0 - 2
src/storage.ts

@@ -4,8 +4,6 @@ export interface Storage {
 
     get(key:string): Promise<any>;
 
-    put(key:string, value:any): Promise<void>;
-
     set(key:string, value:any): Promise<void>;
 
 }