rumious 2.1.3 → 2.1.5

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/index.js CHANGED
@@ -313,6 +313,21 @@ class RumiousState {
313
313
  state: this
314
314
  });
315
315
  }
316
+ entries() {
317
+ if (this.value && typeof this.value === "object")
318
+ return Object.entries(this.value);
319
+ return [];
320
+ }
321
+ map(callback) {
322
+ const val = this.value;
323
+ if (Array.isArray(val)) {
324
+ return val.map((v, i) => callback(v, i));
325
+ }
326
+ if (val && typeof val === "object") {
327
+ return Object.entries(val).map(([k, v]) => callback(v, k));
328
+ }
329
+ return [];
330
+ }
316
331
  }
317
332
  function createState(value) {
318
333
  return new RumiousState(value);
@@ -11,6 +11,8 @@ export declare class RumiousState<T> {
11
11
  toJSON(): string;
12
12
  equal(value: T): boolean;
13
13
  trigger(): void;
14
+ entries(): [any, any][];
15
+ map<R>(callback: (value: unknown, key: any) => R): R[];
14
16
  }
15
17
  export declare function createState<T>(value: T): RumiousState<T>;
16
18
  type StateBindFor<M> = RumiousStateBind<RumiousState<M>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rumious",
3
- "version": "2.1.3",
3
+ "version": "2.1.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",