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

cerebral

Package Overview
Dependencies
Maintainers
1
Versions
638
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cerebral - npm Package Compare versions

Comparing version 0.20.4 to 0.20.5

6

demo/actions/setAllChecked.js
function setAllChecked (args, state) {
let visibleTodos = state.get(['visibleTodos']);
let visibleTodosRefs = state.get(['visibleTodosRefs']);
state.set('isAllChecked', visibleTodos.filter(function(todo) {
state.set('isAllChecked', visibleTodosRefs.filter(function(todo) {
return !todo.completed;
}).length === 0 && visibleTodos.length !== 0);
}).length === 0 && visibleTodosRefs.length !== 0);

@@ -9,0 +9,0 @@ };

@@ -5,3 +5,3 @@ function setVisibleTodos (args, state) {

let filter = state.get('filter');
let visibleTodos = Object.keys(todos).filter(function(key) {
let visibleTodosRefs = Object.keys(todos).filter(function(key) {

@@ -16,3 +16,3 @@ let todo = todos[key];

});
state.set(['visibleTodos'], visibleTodos);
state.set(['visibleTodosRefs'], visibleTodosRefs);

@@ -19,0 +19,0 @@ };

@@ -8,3 +8,3 @@ import React from 'react';

@Cerebral({
visibleTodos: ['visibleTodos'],
visibleTodos: 'visibleTodos',
todos: ['todos'],

@@ -11,0 +11,0 @@ recorder: ['recorder'],

@@ -6,3 +6,3 @@ import React from 'react';

@Cerebral({
todos: ['visibleTodos'],
todos: 'visibleTodos',
isAllChecked: ['isAllChecked']

@@ -9,0 +9,0 @@ })

@@ -13,3 +13,3 @@ import Controller from './../src/index.js';

todos: {},
visibleTodos: [],
visibleTodosRefs: [],
newTodoTitle: '',

@@ -29,5 +29,5 @@ isSaving: false,

controller.compute({
visibleTodos: function (get, refs) {
return refs.map(function (id) {
return get('todos')[id];
visibleTodos: function (get) {
return get(['visibleTodosRefs']).map(function (id) {
return get(['todos', id]);
});

@@ -34,0 +34,0 @@ }

{
"name": "cerebral",
"version": "0.20.4",
"version": "0.20.5",
"description": "A state controller with its own debugger",

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

@@ -9,4 +9,5 @@ var utils = require('./utils.js');

var initialRun = true;
var currentState = {};
var currentValue = null;
var currentValue;

@@ -20,14 +21,16 @@ var get = function(path) {

var isSame = Object.keys(currentState).reduce(function (hasChanged, key) {
var hasChanged = Object.keys(currentState).reduce(function (hasChanged, key) {
if (hasChanged) {
return true;
}
return model.accessors.get(key.split('.')) === currentState[key];
return model.accessors.get(key.split('.')) !== currentState[key];
}, false);
if (isSame) {
return currentValue;
} else {
if (hasChanged || initialRun) {
currentState = {};
initialRun = false;
return currentValue = cb(get);
} else {
return currentValue;
}

@@ -34,0 +37,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