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

cerebral

Package Overview
Dependencies
Maintainers
5
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 5.0.0-1527963057741 to 5.0.0-1528225309613

es/Compute.js

4

es/Controller.js

@@ -13,3 +13,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import { Reaction } from './Reaction';
import { Computed } from './Computed';
import { Compute } from './Compute';
import { Tag } from 'function-tree';

@@ -125,3 +125,3 @@ import { ensureStrictPath, extractModuleProp } from './utils';

if (value instanceof Computed) {
if (value instanceof Compute) {
return value.getValue();

@@ -128,0 +128,0 @@ }

@@ -16,3 +16,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import { DevtoolsBase } from 'function-tree/devtools';
import { Computed } from '../Computed';
import { Compute } from '../Compute';

@@ -64,3 +64,3 @@ var PLACEHOLDER_INITIAL_MODEL = 'PLACEHOLDER_INITIAL_MODEL';

_this.version = "5.0.0-1527963057741";
_this.version = "5.0.0-1528225309613";
_this.debuggerWatchMap = {};

@@ -321,3 +321,3 @@ _this.debuggerComputedMap = {};

value: function updateComputedMap(computed, subscribers) {
if (computed instanceof Computed) {
if (computed instanceof Compute) {
this.debuggerComputedMap[computed.name] = subscribers.filter(function (subscriber) {

@@ -324,0 +324,0 @@ return subscriber.watcher !== computed;

@@ -5,3 +5,28 @@ import ControllerClass from './Controller';

import { DEPRECATE } from './utils';
import * as tags from './tags';
var tagsVar = tags;
if (process.env.NODE_ENV !== 'production' && typeof window.Proxy !== 'undefined') {
tagsVar = Object.keys(tags).reduce(function (proxyHost, key) {
proxyHost[key] = new Proxy(tags[key], {
get: function get(obj, prop) {
console.log('wuut?', obj, prop);
throw new Error('YOU HAVE NOT ENABLED THE BABEL-PLUGIN-CEREBRAL');
}
});
return proxyHost;
}, {});
}
export var props = tagsVar.props;
export var path = tagsVar.path;
export var state = tagsVar.state;
export var sequences = tagsVar.sequences;
export var computed = tagsVar.computed;
export var moduleState = tagsVar.moduleState;
export var moduleSequences = tagsVar.moduleSequences;
export var moduleComputed = tagsVar.moduleComputed;
// Needed to test for instanceof.

@@ -36,3 +61,3 @@ export { default as ModuleClass } from './Module';

export { default as Provider } from './Provider';
export { default as Computed } from './Computed';
export { default as Compute } from './Compute';
export { default as Reaction } from './Reaction';

@@ -39,0 +64,0 @@

export * from './utils';
export { default as BaseModel } from './BaseModel';
export { Computed as ComputedClass } from './Computed';
export { Compute as ComputedClass } from './Compute';
//# sourceMappingURL=internal.js.map

@@ -7,3 +7,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import { Primitive } from 'function-tree';
import { Computed } from './Computed';
import { Compute } from './Compute';
import { Reaction } from './Reaction';

@@ -62,4 +62,4 @@

module.computed = Object.keys(module.computed || {}).reduce(function (registered, computedKey) {
if (!(module.computed[computedKey] instanceof Computed)) {
throw new Error('You are not using a Computed in module on key "' + computedKey + '"');
if (!(module.computed[computedKey] instanceof Compute)) {
throw new Error('You are not using a Compute in module on key "' + computedKey + '"');
}

@@ -66,0 +66,0 @@

import Provider from '../Provider';
import { Computed } from '../Computed';
import { Compute } from '../Compute';

@@ -7,3 +7,3 @@ export default Provider(function (context) {

var value = context.resolve.value(tag);
if (value instanceof Computed) {
if (value instanceof Compute) {
return value.getValue(overrides || context.props);

@@ -10,0 +10,0 @@ }

@@ -12,3 +12,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import Watch from './Watch';
import { Computed } from './Computed';
import { Compute } from './Compute';

@@ -64,3 +64,3 @@ export var Reaction = function (_Watch) {

if (currentDeps[key] instanceof Computed) {
if (currentDeps[key] instanceof Compute) {
currentDeps[key] = currentDeps[key].getValue();

@@ -67,0 +67,0 @@ }

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
import { Tag } from './tags';
import { Computed } from './Computed';
import { Compute } from './Compute';
import { Provider } from 'function-tree';

@@ -222,6 +222,6 @@

isCompute: function isCompute(arg) {
return arg instanceof Computed;
return arg instanceof Compute;
},
value: function value(arg, overrideProps) {
if (arg instanceof Tag || arg instanceof Computed) {
if (arg instanceof Tag || arg instanceof Compute) {
return arg.getValue(overrideProps ? Object.assign({}, getters, { props: overrideProps }) : getters);

@@ -228,0 +228,0 @@ }

@@ -67,6 +67,6 @@ import { DevTools } from './devtools';

export interface ModuleObjectDefinition<State, Sequences, Computed> {
export interface ModuleObjectDefinition<State, Sequences, Compute> {
state?: State;
sequences?: Sequences;
computed?: Computed;
computed?: Compute;
reactions?: {

@@ -102,9 +102,9 @@ [submodule: string]: void;

type ModuleFunction<State, Sequences, Computed> = (
type ModuleFunction<State, Sequences, Compute> = (
module: { name: string; path: string; app: ControllerClass }
) => ModuleObjectDefinition<State, Sequences, Computed>;
) => ModuleObjectDefinition<State, Sequences, Compute>;
export type ModuleDefinition<State = {}, Sequences = {}, Computed = {}> =
| ModuleObjectDefinition<State, Sequences, Computed>
| ModuleFunction<State, Sequences, Computed>;
export type ModuleDefinition<State = {}, Sequences = {}, Compute = {}> =
| ModuleObjectDefinition<State, Sequences, Compute>
| ModuleFunction<State, Sequences, Compute>;

@@ -116,4 +116,4 @@ export class ModuleClass {

export function Module<State = {}, Sequences = {}, Computed = {}>(
moduleDefinition: ModuleDefinition<State, Sequences, Computed>
export function Module<State = {}, Sequences = {}, Compute = {}>(
moduleDefinition: ModuleDefinition<State, Sequences, Compute>
): ModuleClass;

@@ -174,3 +174,3 @@

/*
Computed
Compute
*/

@@ -190,5 +190,5 @@ export type ValueResolver = <T = any>(tag: ResolveValue<T>) => T;

export function Computed<K>(cb: (dependencies: ComputedDependencies) => K): K;
export function Compute<K>(cb: (dependencies: ComputedDependencies) => K): K;
export function Computed<T, K>(dependencies: T, cb: (dependencies: T & ComputedDependencies) => K): K;
export function Compute<T, K>(dependencies: T, cb: (dependencies: T & ComputedDependencies) => K): K;

@@ -195,0 +195,0 @@ export function Reaction<T, K>(dependencies: T, cb: (dependencies: T & ComputedDependencies) => void): void;

@@ -23,3 +23,3 @@ 'use strict';

var _Computed = require('./Computed');
var _Compute = require('./Compute');

@@ -144,3 +144,3 @@ var _functionTree = require('function-tree');

if (value instanceof _Computed.Computed) {
if (value instanceof _Compute.Compute) {
return value.getValue();

@@ -147,0 +147,0 @@ }

@@ -24,3 +24,3 @@ 'use strict';

var _Computed = require('../Computed');
var _Compute = require('../Compute');

@@ -82,3 +82,3 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

_this.version = "5.0.0-1527963057741";
_this.version = "5.0.0-1528225309613";
_this.debuggerWatchMap = {};

@@ -339,3 +339,3 @@ _this.debuggerComputedMap = {};

value: function updateComputedMap(computed, subscribers) {
if (computed instanceof _Computed.Computed) {
if (computed instanceof _Compute.Compute) {
this.debuggerComputedMap[computed.name] = subscribers.filter(function (subscriber) {

@@ -342,0 +342,0 @@ return subscriber.watcher !== computed;

@@ -6,3 +6,3 @@ 'use strict';

});
exports.throwError = exports.createDummyController = exports.View = exports.Reaction = exports.Computed = exports.Provider = exports.CerebralError = exports.ChainSequenceWithPropsFactory = exports.ChainSequenceFactory = exports.BaseControllerClass = exports.ProviderClass = exports.ControllerClass = exports.ModuleClass = undefined;
exports.throwError = exports.createDummyController = exports.View = exports.Reaction = exports.Compute = exports.Provider = exports.CerebralError = exports.ChainSequenceWithPropsFactory = exports.ChainSequenceFactory = exports.BaseControllerClass = exports.ProviderClass = exports.ControllerClass = exports.ModuleClass = exports.moduleComputed = exports.moduleSequences = exports.moduleState = exports.computed = exports.sequences = exports.state = exports.path = exports.props = undefined;

@@ -79,8 +79,8 @@ var _Module = require('./Module');

var _Computed = require('./Computed');
var _Compute = require('./Compute');
Object.defineProperty(exports, 'Computed', {
Object.defineProperty(exports, 'Compute', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Computed).default;
return _interopRequireDefault(_Compute).default;
}

@@ -131,4 +131,35 @@ });

var _tags = require('./tags');
var tags = _interopRequireWildcard(_tags);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var tagsVar = tags;
if (process.env.NODE_ENV !== 'production' && typeof window.Proxy !== 'undefined') {
tagsVar = Object.keys(tags).reduce(function (proxyHost, key) {
proxyHost[key] = new Proxy(tags[key], {
get: function get(obj, prop) {
console.log('wuut?', obj, prop);
throw new Error('YOU HAVE NOT ENABLED THE BABEL-PLUGIN-CEREBRAL');
}
});
return proxyHost;
}, {});
}
var props = exports.props = tagsVar.props;
var path = exports.path = tagsVar.path;
var state = exports.state = tagsVar.state;
var sequences = exports.sequences = tagsVar.sequences;
var computed = exports.computed = tagsVar.computed;
var moduleState = exports.moduleState = tagsVar.moduleState;
var moduleSequences = exports.moduleSequences = tagsVar.moduleSequences;
var moduleComputed = exports.moduleComputed = tagsVar.moduleComputed;
// Needed to test for instanceof.
function Controller(rootModule, options) {

@@ -135,0 +166,0 @@ (0, _utils.DEPRECATE)('Controller', 'Use App default import instead');

@@ -28,3 +28,3 @@ 'use strict';

var _Computed = require('./Computed');
var _Compute = require('./Compute');

@@ -34,3 +34,3 @@ Object.defineProperty(exports, 'ComputedClass', {

get: function get() {
return _Computed.Computed;
return _Compute.Compute;
}

@@ -37,0 +37,0 @@ });

@@ -13,3 +13,3 @@ 'use strict';

var _Computed = require('./Computed');
var _Compute = require('./Compute');

@@ -71,4 +71,4 @@ var _Reaction = require('./Reaction');

module.computed = Object.keys(module.computed || {}).reduce(function (registered, computedKey) {
if (!(module.computed[computedKey] instanceof _Computed.Computed)) {
throw new Error('You are not using a Computed in module on key "' + computedKey + '"');
if (!(module.computed[computedKey] instanceof _Compute.Compute)) {
throw new Error('You are not using a Compute in module on key "' + computedKey + '"');
}

@@ -75,0 +75,0 @@

@@ -11,3 +11,3 @@ 'use strict';

var _Computed = require('../Computed');
var _Compute = require('../Compute');

@@ -19,3 +19,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var value = context.resolve.value(tag);
if (value instanceof _Computed.Computed) {
if (value instanceof _Compute.Compute) {
return value.getValue(overrides || context.props);

@@ -22,0 +22,0 @@ }

@@ -16,3 +16,3 @@ 'use strict';

var _Computed = require('./Computed');
var _Compute = require('./Compute');

@@ -76,3 +76,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

if (currentDeps[key] instanceof _Computed.Computed) {
if (currentDeps[key] instanceof _Compute.Compute) {
currentDeps[key] = currentDeps[key].getValue();

@@ -79,0 +79,0 @@ }

@@ -35,3 +35,3 @@ 'use strict';

var _Computed = require('./Computed');
var _Compute = require('./Compute');

@@ -255,6 +255,6 @@ var _functionTree = require('function-tree');

isCompute: function isCompute(arg) {
return arg instanceof _Computed.Computed;
return arg instanceof _Compute.Compute;
},
value: function value(arg, overrideProps) {
if (arg instanceof _tags.Tag || arg instanceof _Computed.Computed) {
if (arg instanceof _tags.Tag || arg instanceof _Compute.Compute) {
return arg.getValue(overrideProps ? Object.assign({}, getters, { props: overrideProps }) : getters);

@@ -261,0 +261,0 @@ }

{
"name": "cerebral",
"version": "5.0.0-1527963057741",
"version": "5.0.0-1528225309613",
"description": "A state controller with its own debugger",

@@ -24,3 +24,3 @@ "main": "index.js",

"es6-error": "^4.0.2",
"function-tree": "^3.3.0-1527963057741"
"function-tree": "^3.3.0-1528225309613"
},

@@ -27,0 +27,0 @@ "scripts": {

import {
Computed,
Compute,
ModuleClass,

@@ -4,0 +4,0 @@ BaseControllerClass,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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