Socket
Socket
Sign inDemoInstall

deep-state-observer

Package Overview
Dependencies
Maintainers
1
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deep-state-observer - npm Package Compare versions

Comparing version 5.5.9 to 5.5.10

index.js

3

ObjectPath.js

@@ -51,2 +51,5 @@ "use strict";

if (path.length === 0) {
for (var key in obj) {
delete obj[key];
}
for (var key in value) {

@@ -53,0 +56,0 @@ obj[key] = value[key];

@@ -21,2 +21,5 @@ export default class ObjectPath {

if (path.length === 0) {
for (const key in obj) {
delete obj[key];
}
for (const key in value) {

@@ -23,0 +26,0 @@ obj[key] = value[key];

2

package.json
{
"name": "deep-state-observer",
"version": "5.5.9",
"version": "5.5.10",
"description": "Deep state observer is an state management library that will fire listeners only when specified object node (which also can be a wildcard) was changed.",

@@ -5,0 +5,0 @@ "main": "index.esm.js",

@@ -1462,3 +1462,3 @@ const State = require("../index.cjs.js");

it("it should properly clean not recursive path", () => {
it("should properly clean not recursive path", () => {
const state = new State({});

@@ -1468,2 +1468,32 @@ expect(state.cleanNotRecursivePath("config.list.rows;")).toEqual("config.list.rows");

});
it("should replace whole state", () => {
const state = new State({ x: "x" });
expect(state.get()).toEqual({ x: "x" });
state.update("", { y: "y" });
expect(state.get()).toEqual({ y: "y" });
});
it("should subscribe to empty path", () => {
const obj = { x: { y: { z: "z" } } };
const state = new State(obj);
const values = [];
state.subscribe("", (val) => {
values.push(JSON.stringify(val));
});
expect(values.length).toEqual(1);
expect(values[0]).toEqual(JSON.stringify(obj));
state.update("", { a: { b: { c: "c" } } });
expect(values.length).toEqual(2);
expect(values[1]).toEqual(JSON.stringify({ a: { b: { c: "c" } } }));
values.length = 0;
state.subscribe("a.b", (val) => {
values.push(JSON.stringify(val));
});
expect(values.length).toEqual(1);
expect(values[0]).toEqual(JSON.stringify({ c: "c" }));
state.update("a", { b: { c: "cc" } });
expect(values.length).toEqual(2);
expect(values[1]).toEqual(JSON.stringify({ c: "cc" }));
});
});

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc