Compare commits

..

6 Commits

Author SHA1 Message Date
2352dd25db Optimizations
Some checks failed
Build / Build NPM Project (push) Successful in 41s
Build / Publish Documentation (push) Failing after 5s
Build / Tag Version (push) Successful in 8s
2025-07-07 14:33:44 -04:00
80307b363b Revert "Optimizations"
This reverts commit 59bce9d28d.
2025-07-07 14:32:21 -04:00
59bce9d28d Optimizations
Some checks failed
Build / Build NPM Project (push) Failing after 29s
Build / Publish Documentation (push) Has been skipped
Build / Tag Version (push) Has been skipped
2025-07-07 14:29:49 -04:00
387e6b2512 Fixed cache save to db
Some checks failed
Build / Build NPM Project (push) Successful in 43s
Build / Publish Documentation (push) Failing after 5s
Build / Tag Version (push) Successful in 8s
2025-07-07 12:41:44 -04:00
d748d740ea bump 0.26.0
Some checks failed
Build / Build NPM Project (push) Successful in 42s
Build / Publish Documentation (push) Failing after 5s
Build / Tag Version (push) Successful in 8s
2025-07-07 10:52:36 -04:00
c8f44584a2 Fixed cache saving with different backends
Some checks failed
Build / Build NPM Project (push) Successful in 43s
Build / Publish Documentation (push) Failing after 5s
Build / Tag Version (push) Successful in 8s
2025-07-07 10:46:54 -04:00
3 changed files with 5 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@ztimson/utils",
"version": "0.25.27",
"version": "0.26.1",
"description": "Utility library",
"author": "Zak Timson",
"license": "MIT",

View File

@ -75,10 +75,10 @@ export class Cache<K extends string | number | symbol, T> {
}
private save(key?: K) {
const persists: any = this.options.persistentStorage;
const persists: {storage: any, key: string} = <any>this.options.persistentStorage;
if(!!persists?.storage) {
if(persists.storage instanceof Database) {
(<Database>persists.storage).createTable({name: persists.storage.key, key: <string>this.key}).then(table => {
if(persists.storage?.constructor.name == 'Database') {
(<Database>persists.storage).createTable({name: persists.key, key: <string>this.key}).then(table => {
if(key) {
table.set(key, this.get(key));
} else {
@ -86,7 +86,7 @@ export class Cache<K extends string | number | symbol, T> {
this.all().forEach(row => table.add(row));
}
});
} else {
} else if(persists.storage?.constructor.name == 'Storage') {
persists.storage.setItem(persists.storage.key, JSONSanitize(this.all(true)));
}
}

View File

@ -64,7 +64,6 @@ export function fromCsv<T = any>(csv: string, hasHeaders = true): T[] {
});
}
/**
* Convert an array of objects to a CSV string
*