Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 1.0.9 to 1.0.10

2

package.json
{
"name": "deep-state-observer",
"version": "1.0.9",
"version": "1.0.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.cjs.js",

@@ -318,2 +318,38 @@ const { Store, wildcardToRegex } = require('../index.cjs.js');

});
it('should watch recursively within object with numeric values', () => {
const state = new Store({
one: {
two: {
1: { x: 1 },
2: { x: 2 },
3: { x: 3 }
}
}
});
const paths = [];
const values = [];
state.subscribeAll(['one.two...'], (value, path) => {
paths.push(path);
values.push(value);
});
expect(paths.length).toEqual(1);
expect(values.length).toEqual(1);
expect(paths[0]).toEqual('one.two');
expect(values[0]).toEqual({
1: { x: 1 },
'2': { x: 2 },
3: { x: 3 }
});
state.update('one.two.2.x', 22);
expect(paths.length).toEqual(2);
expect(values.length).toEqual(2);
expect(paths[1]).toEqual('one.two.2.x');
expect(values[1]).toEqual({
1: { x: 1 },
'2': { x: 22 },
3: { x: 3 }
});
});
});
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