New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

microcosm

Package Overview
Dependencies
Maintainers
1
Versions
233
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microcosm - npm Package Compare versions

Comparing version 8.0.0-alpha to 8.0.0-alpha2

2

microcosm.build.js

@@ -1,2 +0,2 @@

module.exports=function(t){function n(i){if(r[i])return r[i].exports;var e=r[i]={exports:{},id:i,loaded:!1};return t[i].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){function i(){e.decorate(this),this.state={},this.stores={},this.plugins=[]}var e=r(7),o=r(1),u=r(2),s=r(3),a=r(4),c=r(5),f=r(6);i.prototype={getInitialState:function(){return a(this.stores,function(t){return t.getInitialState()})},get:function(t){return this.state[t]},set:function(t,n){var r=this.get(t);r!==n&&(this.state[t]=n,this.volley())},_commit:function(t){this.state=t,this.volley()},reset:function(){this._commit(this.getInitialState())},replace:function(t){var n=this.deserialize(t);for(var r in n)this.set(r,n[r])},addPlugin:function(t,n){this.plugins.push([t,n])},addStore:function(t,n){this.stores[t]=new u(n,t)},serialize:function(){var t=this;return a(this.stores,function(n){return n.serialize(t.get(n))})},deserialize:function(){var t=this,n=void 0===arguments[0]?{}:arguments[0];return a(n,function(n,r){return t.stores[r].deserialize(n)})},valueOf:function(){return a(this.state,function(t){return t})},toJSON:function(){return this.serialize()},toObject:function(){return this.valueOf()},start:function(){var t=arguments,n=this;return this.reset(),s(this.plugins,this,function(){return c(t,[],n)}),this},push:function(t,n){for(var r=arguments.length,i=Array(r>2?r-2:0),e=2;r>e;e++)i[e-2]=arguments[e];var u=this;return o(t,n,function(n,r){n||u.dispatch(t,r),c(i,[n,r],u)})},dispatch:function(t,n){f(t);for(var r in this.stores){var i=this.get(r),e=this.stores[r];this.set(r,e.send(i,t,n))}return n}},t.exports=i},function(t,n,r){function i(t,n,r){if("function"!=typeof t)throw TypeError(""+t+" is not a function. Is app.push() being called with the wrong value?");var i=t.length>=2?e:o;return i(t,n,r)}function e(t,n,r){return t(n,r)}function o(t,n,r){var i=t(n);return i&&"function"==typeof i.then?(i.then(null,r),i.then(function(t){return r(null,t)})):(r(null,i),i)}t.exports=i},function(t,n,r){function i(t,n){for(var r in t)this[r]=t[r];this.toString=function(){return n}}var e=function(t){return t};i.prototype={getInitialState:e,serialize:e,deserialize:e,register:function(){return this},send:function(t,n,r){var i=this.register()[n];return i?i(t,r):t}},t.exports=i},function(t,n,r){var i=function e(t,n,r){var i=t[0],o=t.slice(1);if(!i)return r();var u=i[0],s=i[1];u.register(n,s,function(t){if(t)throw t;e(o,n,r)})};t.exports=i},function(t,n,r){t.exports=function(t,n){var r={};for(var i in t)r[i]=n(t[i],i,t);return r}},function(t,n,r){t.exports=function(t,n,r){for(var i=0;i<t.length;i++)t[i].apply(r,n)}},function(t,n,r){var i=0;t.exports=function(t){t.hasOwnProperty("toString")||!function(){var n=i+=1;t.toString=function(){return"microcosm_tagged_"+n}}()}},function(t,n,r){function i(t){var n=[],r=null;t=t||{};var i=function(){for(var t=0;t<n.length;t++)n[t]()};return t.listen=function(t){n=n.concat(t)},t.ignore=function(t){n=n.filter(function(n){return n!==t})},t.emit=function(){i()},t.volley=function(){n.length>0&&(cancelAnimationFrame(r),r=requestAnimationFrame(i))},t}t.exports=i(),t.exports.decorate=i}]);
module.exports=function(t){function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var e={};return n.m=t,n.c=e,n.p="",n(0)}([function(t,n,e){function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function i(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(t.__proto__=n)}var o=e(9),u=e(10),s=e(3),a=e(4),c=e(5),f=e(6),h=e(7),l=e(8),p=function(t){function n(){r(this,n),t.call(this),o.decorate(this),this.stores={},this.plugins=[]}return i(n,t),n.prototype.getInitialState=function(){return f(this.stores,function(t){return t.getInitialState()})},n.prototype.reset=function(){this.commit(this.getInitialState())},n.prototype.replace=function(t){var n=this.deserialize(t);for(var e in n)this.set(e,n[e]),this.volley()},n.prototype.addPlugin=function(t,n){this.plugins.push([t,n])},n.prototype.addStore=function(t,n){this.stores[t]=new a(n,t)},n.prototype.serialize=function(){var t=this;return f(this.stores,function(n){return n.serialize(t.get(n))})},n.prototype.deserialize=function(){var t=this,n=void 0===arguments[0]?{}:arguments[0];return f(n,function(n,e){return t.stores[e].deserialize(n)})},n.prototype.toJSON=function(){return this.serialize()},n.prototype.toObject=function(){return this.valueOf()},n.prototype.start=function(){var t=arguments,n=this;return this.reset(),c(this.plugins,this,function(){return h(t,[],n)}),this},n.prototype.push=function(t,n){for(var e=arguments.length,r=Array(e>2?e-2:0),i=2;e>i;i++)r[i-2]=arguments[i];var o=this;return s(t,n,function(n,e){n||o.dispatch(t,e),h(r,[n,e],o)})},n.prototype.dispatch=function(t,n){l(t);for(var e in this.stores){var r=this.get(e),i=this.stores[e];this.set(e,i.send(r,t,n)),this.volley()}return n},n}(u);t.exports=p},function(t,n,e){t.exports=function(t,n,e){var r=n.reduce(function(t,n){return t?t[n]:void 0},t);return void 0===r?e:r}},function(t,n,e){t.exports=function(t){if(Array.isArray(t))return t.slice();var n={};for(var e in t)n[e]=t[e];return n}},function(t,n,e){function r(t,n,e){if("function"!=typeof t)throw TypeError(""+t+" is not a function. Is app.push() being called with the wrong value?");var r=t.length>=2?i:o;return r(t,n,e)}function i(t,n,e){return t(n,e)}function o(t,n,e){var r=t(n);return r&&"function"==typeof r.then?(r.then(null,e),r.then(function(t){return e(null,t)})):(e(null,r),r)}t.exports=r},function(t,n,e){function r(t,n){for(var e in t)this[e]=t[e];this.toString=function(){return n}}var i=function(t){return t};r.prototype={getInitialState:i,serialize:i,deserialize:i,register:function(){return this},send:function(t,n,e){var r=this.register()[n];return r?r(t,e):t}},t.exports=r},function(t,n,e){var r=function i(t,n,e){var r=t[0],o=t.slice(1);if(!r)return e();var u=r[0],s=r[1];u.register(n,s,function(t){if(t)throw t;i(o,n,e)})};t.exports=r},function(t,n,e){t.exports=function(t,n){var e={};for(var r in t)e[r]=n(t[r],r,t);return e}},function(t,n,e){t.exports=function(t,n,e){for(var r=0;r<t.length;r++)t[r].apply(e,n)}},function(t,n,e){var r=0;t.exports=function(t){t.hasOwnProperty("toString")||!function(){var n=r+=1;t.toString=function(){return"microcosm_tagged_"+n}}()}},function(t,n,e){function r(t){var n=[],e=null;t=t||{};var r=function(){for(var t=0;t<n.length;t++)n[t]()};return t.listen=function(t){n=n.concat(t)},t.ignore=function(t){n=n.filter(function(n){return n!==t})},t.emit=function(){r()},t.volley=function(){n.length>0&&(cancelAnimationFrame(e),e=requestAnimationFrame(r))},t}t.exports=r(),t.exports.decorate=r},function(t,n,e){function r(t){this._path=[],this._root=this,this.commit(t)}var i=e(11),o=e(12),u=e(1);r.prototype={getPath:function(t){return this._path.concat(t).filter(function(t){return void 0!==t})},getRoot:function(){return this._root},commit:function(t){this.getRoot()._state=t},clear:function(){this.commit()},get:function(t,n){return u(this._state,this.getPath(t),n)},set:function(t,n){1===arguments.length&&(n=arguments[0],t=void 0),this.commit(i(this._state,this.getPath(t),n))},update:function(t,n){1===arguments.length&&(n=arguments[0],t=void 0);for(var e in n)this.set([t,e],n[e])},remove:function(t){this.commit(o(this._state,this.getPath(t)))},refine:function(t){return Object.create(this,{_path:{value:this.getPath(t)}})},keys:function(){return Object.keys(this.valueOf()||{})},values:function(){return this.keys().map(function(t){return this.get(t)},this)},valueOf:function(){return u(this._state,this.getPath())},toJSON:function(){return this.valueOf()},is:function(t){return t.valueOf()==this.valueOf()},find:function(t,n){return this.filter(t,n)[0]},includes:function(t){return this.indexOf(t)>-1},first:function(){return this.values().shift()},last:function(){return this.values().pop()},size:function(){return this.values().length}};var s=["sort","map","reduce","filter","forEach","some","every","join","indexOf"];s.forEach(function(t){r.prototype[t]=function(){var n;return(n=this.values())[t].apply(n,arguments)}}),t.exports=r},function(t,n,e){var r=e(2),i=e(1);t.exports=function o(t,n,e){if(i(t,n)===e)return t;var u=n[0],s=n.slice(1),a=r(t);return n.length>1?a[u]=o(i(a,[u])||{},s,e):u?a[u]=e:a=e,a}},function(t,n,e){var r=e(2),i=e(1);t.exports=function o(t,n){if(void 0===i(t,n))return t;var e=n[0],u=n.slice(1),s=r(t);return u.length?(s[e]=o(t[e],u),0===Object.keys(s[e]).length&&delete s[e]):delete s[e],s}}]);
//# sourceMappingURL=microcosm.build.js.map
{
"name": "microcosm",
"version": "8.0.0-alpha",
"version": "8.0.0-alpha2",
"description": "A variant of Facebook's Flux with centralized, isolated state",

@@ -16,4 +16,5 @@ "main": "src/Microcosm.js",

"dependencies": {
"diode": "~4.0"
"diode": "~4.0",
"foliage": "^0.18.0"
}
}

@@ -0,1 +1,5 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }
/**

@@ -8,2 +12,3 @@ * Microcosm

var Diode = require('diode');
var Foliage = require('foliage');
var Signal = require('./Signal');

@@ -16,41 +21,27 @@ var Store = require('./Store');

function Microcosm() {
Diode.decorate(this);
var Microcosm = (function (_Foliage) {
function Microcosm() {
_classCallCheck(this, Microcosm);
this.state = {};
this.stores = {};
this.plugins = [];
}
_Foliage.call(this);
Microcosm.prototype = {
Diode.decorate(this);
getInitialState: function getInitialState() {
this.stores = {};
this.plugins = [];
}
_inherits(Microcosm, _Foliage);
Microcosm.prototype.getInitialState = function getInitialState() {
return remap(this.stores, function (store) {
return store.getInitialState();
});
},
};
get: function get(key) {
return this.state[key];
},
Microcosm.prototype.reset = function reset() {
this.commit(this.getInitialState());
};
set: function set(key, value) {
var current = this.get(key);
if (current !== value) {
this.state[key] = value;
this.volley();
}
},
_commit: function _commit(state) {
this.state = state;
this.volley();
},
reset: function reset() {
this._commit(this.getInitialState());
},
replace: function replace(data) {
Microcosm.prototype.replace = function replace(data) {
var cleaned = this.deserialize(data);

@@ -60,14 +51,15 @@

this.set(key, cleaned[key]);
this.volley();
}
},
};
addPlugin: function addPlugin(plugin, options) {
Microcosm.prototype.addPlugin = function addPlugin(plugin, options) {
this.plugins.push([plugin, options]);
},
};
addStore: function addStore(key, config) {
Microcosm.prototype.addStore = function addStore(key, config) {
this.stores[key] = new Store(config, key);
},
};
serialize: function serialize() {
Microcosm.prototype.serialize = function serialize() {
var _this = this;

@@ -78,5 +70,5 @@

});
},
};
deserialize: function deserialize() {
Microcosm.prototype.deserialize = function deserialize() {
var _this2 = this;

@@ -89,19 +81,13 @@

});
},
};
valueOf: function valueOf() {
return remap(this.state, function (i) {
return i;
});
},
toJSON: function toJSON() {
Microcosm.prototype.toJSON = function toJSON() {
return this.serialize();
},
};
toObject: function toObject() {
Microcosm.prototype.toObject = function toObject() {
return this.valueOf();
},
};
start: function start() {
Microcosm.prototype.start = function start() {
var _arguments = arguments,

@@ -118,5 +104,5 @@ _this3 = this;

return this;
},
};
push: function push(action, params) {
Microcosm.prototype.push = function push(action, params) {
for (var _len = arguments.length, callbacks = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {

@@ -135,5 +121,5 @@ callbacks[_key - 2] = arguments[_key];

});
},
};
dispatch: function dispatch(action, params) {
Microcosm.prototype.dispatch = function dispatch(action, params) {
tag(action);

@@ -146,10 +132,12 @@

this.set(key, store.send(state, action, params));
this.volley();
}
return params;
}
};
};
return Microcosm;
})(Foliage);
module.exports = Microcosm;
//# sourceMappingURL=data:application/json;base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IHBhcmFtcykpXG4gICAgICB0aGlzLnZvbGxleSgpXG4gICAgfVxuXG4gICAgcmV0dXJuIHBhcmFtc1xuICB9XG5cbn1cblxubW9kdWxlLmV4cG9ydHMgPSBNaWNyb2Nvc21cbiJdfQ==

Sorry, the diff of this file is not supported yet

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