@superutils/rx 0.1.2 → 0.1.4
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/browser/index.min.js +2 -2
- package/dist/browser/index.min.js.map +1 -1
- package/dist/index.cjs +6 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -3
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -294,7 +294,10 @@ var DataStorage = class {
|
|
|
294
294
|
this.setAll(data, true);
|
|
295
295
|
return this;
|
|
296
296
|
};
|
|
297
|
-
this.find = (predicateOrOptions) => (0, import_core6.find)(
|
|
297
|
+
this.find = (predicateOrOptions) => (0, import_core6.find)(
|
|
298
|
+
this.getAll(),
|
|
299
|
+
predicateOrOptions
|
|
300
|
+
);
|
|
298
301
|
this.filter = (predicate, limit, asArray, result) => (0, import_core6.filter)(this.getAll(), predicate, limit, asArray, result);
|
|
299
302
|
this.get = (key) => this.getAll().get(key);
|
|
300
303
|
this.getAll = (forceRead = false) => {
|
|
@@ -380,10 +383,10 @@ var DataStorage = class {
|
|
|
380
383
|
this.subject.next(new Map(data));
|
|
381
384
|
return this;
|
|
382
385
|
};
|
|
383
|
-
this.sort = ((
|
|
386
|
+
this.sort = ((byKeyOrNameOrComparator, options) => {
|
|
384
387
|
const result = (0, import_core6.sort)(
|
|
385
388
|
this.getAll(),
|
|
386
|
-
|
|
389
|
+
byKeyOrNameOrComparator,
|
|
387
390
|
options
|
|
388
391
|
);
|
|
389
392
|
(options == null ? void 0 : options.save) && this.setAll(result, true);
|
package/dist/index.d.cts
CHANGED
|
@@ -185,7 +185,7 @@ type StorageSortOptions = SortOptions & {
|
|
|
185
185
|
type StorageStringifyFn<K, V extends StorageValue> = (data: Map<K, V>) => string;
|
|
186
186
|
type StorageToJSON<K, V> = (replacer?: null | ((key: K, value: V) => unknown), spacing?: string | number, data?: Map<K, V>) => string;
|
|
187
187
|
type StorageKey = string;
|
|
188
|
-
type StorageValue =
|
|
188
|
+
type StorageValue = object;
|
|
189
189
|
interface IDataStorage<Key extends StorageKey, Value extends StorageValue, CacheDisabled extends boolean = false> {
|
|
190
190
|
/** Disable in-memory cache and only directly read/write from storage (local storage or JSON fle) */
|
|
191
191
|
readonly cacheDisabled: CacheDisabled;
|
package/dist/index.d.ts
CHANGED
|
@@ -185,7 +185,7 @@ type StorageSortOptions = SortOptions & {
|
|
|
185
185
|
type StorageStringifyFn<K, V extends StorageValue> = (data: Map<K, V>) => string;
|
|
186
186
|
type StorageToJSON<K, V> = (replacer?: null | ((key: K, value: V) => unknown), spacing?: string | number, data?: Map<K, V>) => string;
|
|
187
187
|
type StorageKey = string;
|
|
188
|
-
type StorageValue =
|
|
188
|
+
type StorageValue = object;
|
|
189
189
|
interface IDataStorage<Key extends StorageKey, Value extends StorageValue, CacheDisabled extends boolean = false> {
|
|
190
190
|
/** Disable in-memory cache and only directly read/write from storage (local storage or JSON fle) */
|
|
191
191
|
readonly cacheDisabled: CacheDisabled;
|
package/dist/index.js
CHANGED
|
@@ -281,7 +281,10 @@ var DataStorage = class {
|
|
|
281
281
|
this.setAll(data, true);
|
|
282
282
|
return this;
|
|
283
283
|
};
|
|
284
|
-
this.find = (predicateOrOptions) => find(
|
|
284
|
+
this.find = (predicateOrOptions) => find(
|
|
285
|
+
this.getAll(),
|
|
286
|
+
predicateOrOptions
|
|
287
|
+
);
|
|
285
288
|
this.filter = (predicate, limit, asArray, result) => filter(this.getAll(), predicate, limit, asArray, result);
|
|
286
289
|
this.get = (key) => this.getAll().get(key);
|
|
287
290
|
this.getAll = (forceRead = false) => {
|
|
@@ -367,10 +370,10 @@ var DataStorage = class {
|
|
|
367
370
|
this.subject.next(new Map(data));
|
|
368
371
|
return this;
|
|
369
372
|
};
|
|
370
|
-
this.sort = ((
|
|
373
|
+
this.sort = ((byKeyOrNameOrComparator, options) => {
|
|
371
374
|
const result = sort(
|
|
372
375
|
this.getAll(),
|
|
373
|
-
|
|
376
|
+
byKeyOrNameOrComparator,
|
|
374
377
|
options
|
|
375
378
|
);
|
|
376
379
|
(options == null ? void 0 : options.save) && this.setAll(result, true);
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"author": "Toufiqur Rahaman Chowdhury",
|
|
3
3
|
"description": "RxJS utilities and hooks for React applications.",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@superutils/core": "^1.2.
|
|
6
|
-
"@superutils/promise": "^1.3.
|
|
5
|
+
"@superutils/core": "^1.2.9",
|
|
6
|
+
"@superutils/promise": "^1.3.8",
|
|
7
7
|
"@types/react": "^18.0.0",
|
|
8
8
|
"react": ">=16.8.0",
|
|
9
9
|
"rxjs": "^7.8.2"
|
|
@@ -49,6 +49,6 @@
|
|
|
49
49
|
"module": "./dist/index.js",
|
|
50
50
|
"type": "module",
|
|
51
51
|
"types": "./dist/index.d.ts",
|
|
52
|
-
"version": "0.1.
|
|
53
|
-
"gitHead": "
|
|
52
|
+
"version": "0.1.4",
|
|
53
|
+
"gitHead": "1faa1c8734f9892abb9e07616b62abeeff1321b5"
|
|
54
54
|
}
|