@ztimson/utils 0.26.2 → 0.26.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database.d.ts +1 -1
- package/dist/index.cjs +8 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +8 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1141,15 +1141,19 @@ class Table {
|
|
|
1141
1141
|
getAllKeys() {
|
|
1142
1142
|
return this.tx(this.name, (store) => store.getAllKeys(), true);
|
|
1143
1143
|
}
|
|
1144
|
-
put(
|
|
1145
|
-
return this.tx(this.name, (store) =>
|
|
1144
|
+
put(value, key) {
|
|
1145
|
+
return this.tx(this.name, (store) => {
|
|
1146
|
+
if (store.keyPath) return store.put(value);
|
|
1147
|
+
return store.put(value, key);
|
|
1148
|
+
});
|
|
1146
1149
|
}
|
|
1147
1150
|
read(key) {
|
|
1148
1151
|
return key ? this.get(key) : this.getAll();
|
|
1149
1152
|
}
|
|
1150
1153
|
set(value, key) {
|
|
1151
|
-
if (
|
|
1152
|
-
|
|
1154
|
+
if (key) value[this.key] = key;
|
|
1155
|
+
if (!value[this.key]) return this.add(value);
|
|
1156
|
+
return this.put(value);
|
|
1153
1157
|
}
|
|
1154
1158
|
}
|
|
1155
1159
|
class PromiseProgress extends Promise {
|