Socket
Socket
Sign inDemoInstall

proxy-state-tree

Package Overview
Dependencies
Maintainers
1
Versions
865
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proxy-state-tree - npm Package Compare versions

Comparing version 1.0.0-beta3 to 1.0.0-beta4

58

dist/proxy-state-tree.cjs.js

@@ -154,3 +154,3 @@ 'use strict';

flush() {
const pathCallbacksCalled = [];
const pathCallbacksCalled = new Set();

@@ -161,7 +161,5 @@ for (let mutation in this.mutations) {

if (this.pathDependencies[path]) {
for (let pathCallback in this.pathDependencies[path]) {
const callback = this.pathDependencies[path][pathCallback];
if (pathCallbacksCalled.indexOf(callback) === -1) {
pathCallbacksCalled.push(callback);
for (let callback of this.pathDependencies[path]) {
if (!pathCallbacksCalled.has(callback)) {
pathCallbacksCalled.add(callback);
callback();

@@ -172,3 +170,3 @@ }

}
pathCallbacksCalled.length = 0;
pathCallbacksCalled.clear();
}

@@ -214,3 +212,2 @@ startMutationTracking() {

const pathSet = this.paths[index];
const paths = Array.from(pathSet);
this.paths.pop();

@@ -222,3 +219,3 @@

return paths;
return pathSet;
}

@@ -229,31 +226,21 @@ addMutationListener(initialPaths, cb) {

for (let index in currentStringPaths) {
const currentStringPath = currentStringPaths[index];
for (let currentStringPath of currentStringPaths) {
pathDependencies[currentStringPath] = pathDependencies[currentStringPath]
? pathDependencies[currentStringPath].concat(cb)
: [cb];
? pathDependencies[currentStringPath].add(cb)
: new Set([cb]);
}
return {
update(newPaths) {
const newStringPaths = newPaths;
for (let index in currentStringPaths) {
const currentStringPath = currentStringPaths[index];
if (newStringPaths.indexOf(currentStringPath) === -1) {
pathDependencies[currentStringPath].splice(
pathDependencies[currentStringPath].indexOf(cb),
1
);
update(newStringPaths) {
for (let currentStringPath of currentStringPaths) {
if (!newStringPaths.has(currentStringPath)) {
pathDependencies[currentStringPath].delete(cb);
}
}
for (let index in newStringPaths) {
const newStringPath = newStringPaths[index];
if (currentStringPaths.indexOf(newStringPath) === -1) {
for (let newStringPath of newStringPaths) {
if (!currentStringPaths.has(newStringPath)) {
pathDependencies[newStringPath] = pathDependencies[newStringPath]
? pathDependencies[newStringPath].concat(cb)
: [cb];
? pathDependencies[newStringPath].add(cb)
: new Set([cb]);
}

@@ -265,11 +252,6 @@ }

dispose() {
for (let index in currentStringPaths) {
const currentStringPath = currentStringPaths[index];
for (let currentStringPath of currentStringPaths) {
pathDependencies[currentStringPath].delete(cb);
pathDependencies[currentStringPath].splice(
pathDependencies[currentStringPath].indexOf(cb),
1
);
if (!pathDependencies[currentStringPath].length) {
if (pathDependencies[currentStringPath].size === 0) {
delete pathDependencies[currentStringPath];

@@ -276,0 +258,0 @@ }

@@ -148,3 +148,3 @@ import isPlainObject from 'is-plain-object';

flush() {
const pathCallbacksCalled = [];
const pathCallbacksCalled = new Set();

@@ -155,7 +155,5 @@ for (let mutation in this.mutations) {

if (this.pathDependencies[path]) {
for (let pathCallback in this.pathDependencies[path]) {
const callback = this.pathDependencies[path][pathCallback];
if (pathCallbacksCalled.indexOf(callback) === -1) {
pathCallbacksCalled.push(callback);
for (let callback of this.pathDependencies[path]) {
if (!pathCallbacksCalled.has(callback)) {
pathCallbacksCalled.add(callback);
callback();

@@ -166,3 +164,3 @@ }

}
pathCallbacksCalled.length = 0;
pathCallbacksCalled.clear();
}

@@ -208,3 +206,2 @@ startMutationTracking() {

const pathSet = this.paths[index];
const paths = Array.from(pathSet);
this.paths.pop();

@@ -216,3 +213,3 @@

return paths;
return pathSet;
}

@@ -223,31 +220,21 @@ addMutationListener(initialPaths, cb) {

for (let index in currentStringPaths) {
const currentStringPath = currentStringPaths[index];
for (let currentStringPath of currentStringPaths) {
pathDependencies[currentStringPath] = pathDependencies[currentStringPath]
? pathDependencies[currentStringPath].concat(cb)
: [cb];
? pathDependencies[currentStringPath].add(cb)
: new Set([cb]);
}
return {
update(newPaths) {
const newStringPaths = newPaths;
for (let index in currentStringPaths) {
const currentStringPath = currentStringPaths[index];
if (newStringPaths.indexOf(currentStringPath) === -1) {
pathDependencies[currentStringPath].splice(
pathDependencies[currentStringPath].indexOf(cb),
1
);
update(newStringPaths) {
for (let currentStringPath of currentStringPaths) {
if (!newStringPaths.has(currentStringPath)) {
pathDependencies[currentStringPath].delete(cb);
}
}
for (let index in newStringPaths) {
const newStringPath = newStringPaths[index];
if (currentStringPaths.indexOf(newStringPath) === -1) {
for (let newStringPath of newStringPaths) {
if (!currentStringPaths.has(newStringPath)) {
pathDependencies[newStringPath] = pathDependencies[newStringPath]
? pathDependencies[newStringPath].concat(cb)
: [cb];
? pathDependencies[newStringPath].add(cb)
: new Set([cb]);
}

@@ -259,11 +246,6 @@ }

dispose() {
for (let index in currentStringPaths) {
const currentStringPath = currentStringPaths[index];
for (let currentStringPath of currentStringPaths) {
pathDependencies[currentStringPath].delete(cb);
pathDependencies[currentStringPath].splice(
pathDependencies[currentStringPath].indexOf(cb),
1
);
if (!pathDependencies[currentStringPath].length) {
if (pathDependencies[currentStringPath].size === 0) {
delete pathDependencies[currentStringPath];

@@ -270,0 +252,0 @@ }

{
"name": "proxy-state-tree",
"version": "1.0.0-beta3",
"version": "1.0.0-beta4",
"description": "An implementation of the Mobx/Vue state tracking approach, for library authors",

@@ -5,0 +5,0 @@ "main": "dist/proxy-state-tree.cjs.js",

@@ -49,3 +49,3 @@ # proxy-state-tree

console.log(paths) // ['foo', 'bar']
console.log(paths) // Set { 'foo', 'bar' }
```

@@ -52,0 +52,0 @@

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