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

docbrown

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docbrown - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

58

index.js

@@ -96,2 +96,31 @@ (function() {

var baseStoreProto = {
getState: function() {
return this.__state;
},
setState: function(state) {
if (typeof state !== "object") {
throw new Error("setState only accepts objects");
}
// Poor man's inefficient but strict & safe change check. I know.
var changed = Object.keys(state).some(function(prop) {
return !this.__state.hasOwnProperty(prop) ||
state[prop] !== this.__state[prop];
}, this);
if (!changed) return;
this.__state = merge({}, this.__state, state);
this.__listeners.forEach(function(listener) {
listener(this.__state);
}.bind(this));
},
subscribe: function(listener) {
this.__listeners.push(listener);
},
unsubscribe: function(listener) {
this.__listeners = this.__listeners.filter(function(registered) {
return registered !== listener;
});
}
};
DocBrown.createStore = function(storeProto) {

@@ -122,34 +151,7 @@ if (typeof storeProto !== "object") {

}
BaseStore.prototype = merge({
get state() {
return this.__state;
},
getState: function() {
return this.__state;
},
setState: function(state) {
if (typeof state !== "object") {
throw new Error("setState only accepts objects");
}
// Poor man's inefficient but strict & safe change check. I know.
var changed = Object.keys(state).some(function(prop) {
return !this.__state.hasOwnProperty(prop) ||
state[prop] !== this.__state[prop];
}, this);
if (!changed) return;
this.__state = merge({}, this.__state, state);
this.__listeners.forEach(function(listener) {
listener(this.__state);
}.bind(this));
},
subscribe: function(listener) {
this.__listeners.push(listener);
},
unsubscribe: function(listener) {
this.__listeners = this.__listeners.filter(function(registered) {
return registered !== listener;
});
}
}, storeProto);
}, baseStoreProto, storeProto);
return BaseStore;

@@ -156,0 +158,0 @@ };

{
"name": "docbrown",
"version": "0.4.0",
"version": "0.4.1",
"description": "Flux experiment.",

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

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