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

cerebral-model-immutable-js

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cerebral-model-immutable-js - npm Package Compare versions

Comparing version 0.1.5 to 0.2.0

21

index.js
var Immutable = require('immutable');
var Baobab = require('baobab');

@@ -14,4 +15,4 @@ var Model = function (initialState) {

controller.on('seek', function (seek, recording) {
recording.initialState.forEach(function (state) {
tree.set(state.path, state.value);
recording.initialState.forEach(function (stateUpdate) {
state = state.setIn(stateUpdate.path, Immutable.fromJS(stateUpdate.value));
});

@@ -29,3 +30,3 @@ });

toJS: function (path) {
return state.get(path).toJS();
return state.getIn(path).toJS();
},

@@ -51,6 +52,6 @@ export: function () {

import: function (newState) {
return state = state.mergeDeep(newState);
return state = state.mergeDeep(Immutable.fromJS(newState));
},
set: function (path, value) {
state = state.setIn(path, value);
state = state.setIn(path, Immutable.fromJS(value));
},

@@ -69,3 +70,3 @@ unset: function (path, keys) {

state = state.updateIn(path, function (array) {
return array.push(value);
return array.push(Immutable.fromJS(value));
});

@@ -77,7 +78,7 @@ },

state = state.updateIn(path, function (array) {
return array.splice.apply(array, args);
return array.splice.apply(array, args.map(Immutable.fromJS.bind(Immutable)));
});
},
merge: function (path, value) {
state = state.mergeIn(path, value);
state = state.mergeIn(path, Immutable.fromJS(value));
},

@@ -88,3 +89,3 @@ concat: function () {

state = state.updateIn(path, function (array) {
return array.concat.apply(array, args);
return array.concat.apply(array, args.map(Immutable.fromJS.bind(Immutable)));
});

@@ -106,3 +107,3 @@ },

state = state.updateIn(path, function (array) {
return array.unshift.apply(array, args);
return array.unshift.apply(array, args.map(Immutable.fromJS.bind(Immutable)));
});

@@ -109,0 +110,0 @@ }

{
"name": "cerebral-model-immutable-js",
"version": "0.1.5",
"version": "0.2.0",
"description": "A state package for Cerebral",

@@ -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