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

immview

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immview - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

2

dist/immview.js

@@ -63,3 +63,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _Queue=__webpack_require__(2),_Queue2=_interopRequireDefault(_Queue),noop=function(){},Domain=function(){function e(t,i){_classCallCheck(this,e),this.view=null,this.data=null,this._actionNames=null,this._claimView(t),this._claimActions(i)}return _createClass(e,[{key:"_claimView",value:function(e){if(!e.isReactor)throw new Error("view is not inheriting Reactor type");this.view=e,e.isData&&(this.data=e)}},{key:"_claimActions",value:function(e){var t=this;this._actionNames=e?Object.keys(e):[],this._actionNames.forEach(function(i){if(t[i])throw new Error('"'+i+'" is reserved for Domain interface');t[i]=_Queue2["default"].createAction(e[i],t)})}},{key:"read",value:function(){return this.view.read()}},{key:"map",value:function(e){return this.view.map(e)}},{key:"subscribe",value:function(e){return this.view.subscribe(e)}},{key:"destroy",value:function(){var e=this;this.view.destroy(),this.view=null,this.data=null,_Queue2["default"].rejectContext(this),this._actionNames.forEach(function(t){e[t]=noop}),this._actionNames=null}},{key:"structure",get:function(){return this.view&&this.view.structure}},{key:"isDomain",get:function(){return!0}}]),e}();exports["default"]=Domain;
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}();Object.defineProperty(exports,"__esModule",{value:!0});var _Queue=__webpack_require__(2),_Queue2=_interopRequireDefault(_Queue),noop=function(){},Domain=function(){function e(t,i){_classCallCheck(this,e),this.view=null,this.data=null,this._actionNames=null,this._claimView(t),this._claimActions(i)}return _createClass(e,[{key:"_claimView",value:function(e){if(!e.isReactor)throw new Error("view is not inheriting Reactor type");this.view=e,e.isData&&(this.data=e)}},{key:"_claimActions",value:function(e){var t=this;this._actionNames=e?Object.keys(e):[],this._actionNames.forEach(function(i){if(t[i])throw new Error('"'+i+'" is reserved for Domain interface');t[i]=_Queue2["default"].createAction(e[i],t)})}},{key:"read",value:function(){return this.view.read()}},{key:"map",value:function(e){return this.view.map(e)}},{key:"subscribe",value:function(e){return this.view.subscribe(e)}},{key:"appendReactor",value:function(e){return this.view.appendReactor(e)}},{key:"destroy",value:function(){var e=this;this.view.destroy(),this.view=null,this.data=null,_Queue2["default"].rejectContext(this),this._actionNames.forEach(function(t){e[t]=noop}),this._actionNames=null}},{key:"structure",get:function(){return this.view&&this.view.structure}},{key:"isDomain",get:function(){return!0}}]),e}();exports["default"]=Domain;

@@ -66,0 +66,0 @@ /***/ },

{
"name": "immview",
"version": "1.4.0",
"version": "1.4.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/immview.js",

@@ -7,4 +7,11 @@ # immview

With full usage of the library, you can think of it as of streams lines going only vertically, layer by layer, so it is always clear which layer depends on each other. **Down streams** (because of usage of Immutable.js) will only push data further only if data they contain (**Data**) or produce (**View**) actually changed. Layer **up stream** is a way to signal upper layers - they are counterpart of actions in flux.
Think of the library as tool for creating application layers/**domains** that are encapsulating concerns. These domains are revealing **single storage with [streaming](https://en.wikipedia.org/wiki/Stream_%28computing%29) capability** and an **interface to manipulate that storage** either directly or indirectly if assigned storage is transformation product of some other domain storage.
Storage of a **Domain** can be either original data source (**Data**) or derivative data source (**View**). **Views** can be created as derivative from a **Data**, other **View** or combination of those and optionally use a transformation function. By doing so derivative data source subscribes to all changes to its source or sources and recalculates itself upon these changes optionally using provided transformation function.
Due to this functionality if you familiar with stream libraries like Rx* they can be seen as **Data** being observable and **View** be merging and/or mapping stream.
All **Domains** must have a storage (so either **Data** or a **View**), but not all storages must be assigned to a **Domain**.
**Storages** (thanks to utilizing Immutable.js) will only push changes only if actual change is detected.
**Domains** are exposing interface to either manipulate **Data** instances or use interface of other **Domains**.
### Compounds

@@ -36,3 +43,3 @@

## Example
## Simple down stream example

@@ -64,3 +71,3 @@ ```javascript

/** A CHANGE! */
dataSource.set('a', 3);
dataSource.write(data => data.set('a', 3));

@@ -67,0 +74,0 @@ console.log(dataSource.toJS());

@@ -60,3 +60,3 @@ import Queue from './Queue.js';

}
map(nextProcessor) {

@@ -79,2 +79,6 @@ return this.view.map(nextProcessor);

appendReactor(reaction) {
return this.view.appendReactor(reaction);
}
destroy() {

@@ -81,0 +85,0 @@ // destroy and unmount a structure

@@ -29,2 +29,10 @@ import Domain from '../src/Domain';

it('can be created from a Domains', function () {
var aData = new Data({ a: 1 });
var aView = new View(aData, i=>i);
var aDomain = new Domain(aView, {});
var resultView = new View({ aD: aDomain }, i=>i);
expect(resultView.read().getIn(['aD', 'a'])).toBe(1);
});
describe('', function () {

@@ -31,0 +39,0 @@ var d;

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