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

cerebral-module-fuse

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cerebral-module-fuse - npm Package Compare versions

Comparing version 0.1.5 to 0.2.0

lib/computed.js

6

lib/actions/search.js

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

'use strict';
"use strict";

@@ -7,6 +7,4 @@ Object.defineProperty(exports, "__esModule", {

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); } }
exports.default = function (modulePath) {
var queryPath = [].concat(_toConsumableArray(modulePath), ['query']);
var queryPath = modulePath + ".query";

@@ -13,0 +11,0 @@ return function (_ref) {

@@ -11,10 +11,8 @@ 'use strict';

var _compute = require('./compute');
var _computed = require('./computed');
var _compute2 = _interopRequireDefault(_compute);
var _computed2 = _interopRequireDefault(_computed);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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); } }
exports.default = function (_ref) {

@@ -25,6 +23,5 @@ var statePath = _ref.statePath;

return function (module) {
var modulePath = module.name.split('.');
var modulePath = module.name;
module.addState({
statePath: statePath,
options: options,

@@ -39,6 +36,7 @@ query: null

module.addServices({
fuse: (0, _compute2.default)(modulePath),
queryPath: [].concat(_toConsumableArray(modulePath), ['query'])
get: function get(state) {
return state.computed((0, _computed2.default)({ modulePath: modulePath, statePath: statePath }));
}
});
};
};
{
"name": "cerebral-module-fuse",
"version": "0.1.5",
"version": "0.2.0",
"description": "A cerebral module that adds fuzzy search to data in store",

@@ -11,3 +11,3 @@ "main": "lib/index.js",

"lint": "standard src/**/*.js test/**/*.js --verbose | snazzy",
"start": "parallelshell 'babel src --watch --out-dir lib' 'watch --wait=1 \"npm run lint && mocha --compilers js:babel-core/register --recursive --reporter dot\" src test'",
"start": "parallelshell 'babel src --watch --out-dir lib' 'watch --wait=1 \"npm run lint && mocha --compilers js:babel-core/register --recursive\" src test'",
"prebuild": "npm run lint",

@@ -37,21 +37,23 @@ "build": "rimraf lib && babel src --out-dir lib",

"devDependencies": {
"babel": "^6.5.1",
"babel-cli": "^6.5.1",
"babel-core": "^6.5.1",
"babel-preset-es2015": "^6.5.0",
"baobab": "^2.3.3",
"cerebral": "^0.33.24",
"babel": "^6.5.2",
"babel-cli": "^6.11.4",
"babel-core": "^6.11.4",
"babel-preset-es2015": "^6.9.0",
"cerebral": "^0.35.7",
"cerebral-model-baobab": "^0.4.7",
"cerebral-testable": "^0.3.2",
"chai": "^3.5.0",
"eslint": "^2.0.0-rc.0",
"mocha": "^2.4.5",
"mocha": "^3.0.0",
"parallelshell": "^2.0.0",
"rimraf": "^2.5.1",
"snazzy": "^2.0.1",
"standard": "^6.0.4",
"watch": "^0.17.1"
"rimraf": "^2.5.4",
"snazzy": "^4.0.0",
"standard": "^7.1.2",
"watch": "^0.19.1"
},
"dependencies": {
"fuse.js": "^1.3.1"
"fuse.js": "^2.3.0"
},
"peerDependencies": {
"cerebral": "^0.35.0"
}
}

@@ -17,7 +17,7 @@ # cerebral-module-fuse

import controller from './controller'
import fuse form 'cerebral-module-fuse'
import fuse from 'cerebral-module-fuse'
controller.modules({
findUsers: fuse({
statePath: ['users'], // statePath should point to either an object or array in the store
statePath: 'users', // statePath should point to either an object or array in the store
options: { keys: ['firstName', 'lastName'] } // options are passed on to fuse.js

@@ -33,20 +33,15 @@ })

```js
import React from 'react';
import { Decorator as Cerebral } from 'cerebral-view-react';
import fuse from 'cerebral-module-fuse/compute';
import React from 'react'
import { connect } from 'cerebral-view-react'
import fuse from 'cerebral-module-fuse/computed'
@Cerebral({
users: fuse(['findUsers']) // where fuse is given the path to the module state
})
class App extends React.Component {
render() {
return (
<ul>
{this.props.users.map(user => (
<li>{`${user.firstName} ${user.lastName}`}</li>
))}
</ul>
);
}
}
export default connect({
users: fuse({ modulePath: 'findUsers', statePath: 'users' })
}, ({ users }) => (
<ul>
{users.map(user => (
<li>{`${user.firstName} ${user.lastName}`}</li>
))}
</ul>
))
```

@@ -60,7 +55,7 @@

you can also access the filtered data from an action via the provided services
you can also access the filtered data from an action via the provided service
```js
export default myAction({ state, services: { findUsers } }) {
const users = state.get(findUsers.fuse)
const users = findUsers.get(state)
}

@@ -77,2 +72,2 @@ ```

* `npm run lint` lints the code
* `npm run build` compiles es6 to es5
* `npm run build` compiles es2015 to es5
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