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

fluxury

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fluxury - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

7

package.json
{
"name": "fluxury",
"version": "0.3.5",
"version": "0.3.6",
"description": "Add luxury sugar to simplify implementing Facebook's flavor of Flux architecture.",

@@ -17,5 +17,6 @@ "main": "./lib/index.js",

"devDependencies": {
"tape": "^4.2.2",
"object-assign": "^4.0.1"
"immutable": "^3.7.5",
"object-assign": "^4.0.1",
"tape": "^4.2.2"
}
}

@@ -210,3 +210,3 @@ # fluxury

## MapStore Example
## MapStore with defensive copies

@@ -237,3 +237,2 @@ A simple store that accumulates data on each `SET` action.

dispatch(SET, { programs: [{ name: 'A', states: ['CA']}] })
// store.queries.getStates() => { states: ['CA', 'OR', 'WA']] }
// store.queries.getPrograms() => { programs: [{ name: 'A', states: ['CA']}] }

@@ -248,4 +247,34 @@

## MapStore with Immutable data structures
Here is a similar MapStore with Immutable.js.
```js
var {dispatch, createStore, createActions } = require('fluxury');
var {SET, DELETE} = createActions('SET', 'DELETE');
var Immutable = require('Immutable');
var store = Fluxury.createStore('MapStore', Immutable.Map(), function(state, action) {
t.plan(8)
switch (action.type) {
case SET:
// combine both objects into a single new object
return state.merge(action.data);
default:
return state;
}
}, {
getStates: (state) => state.get('states'),
getPrograms: (state) => state.get('programs'),
getSelectedState: (state) => state.get('selectedState'),
has: (state, param) => state.has(param),
includes: (state, param) => state.includes(param),
first: (state) => state.first(),
last: (state) => state.last(),
all: (state) => state.toJS(),
});
```
## Example Applications
[CSV File Viewer](https://github.com/petermoresi/react-csv-file-viewer)

@@ -82,1 +82,44 @@ var test = require('tape');

})
test('ImmutableMapStore', function(t) {
var Fluxury = require('./lib/index'),
dispatch = Fluxury.dispatch
SET = 'SET',
Immutable = require('immutable');
var store = Fluxury.createStore('MapStore', Immutable.Map(), function(state, action) {
t.plan(8)
switch (action.type) {
case SET:
// combine both objects into a single new object
return state.merge(action.data);
default:
return state;
}
}, {
getStates: (state) => state.get('states'),
getPrograms: (state) => state.get('programs'),
getSelectedState: (state) => state.get('selectedState'),
has: (state, param) => state.has(param),
includes: (state, param) => state.includes(param),
first: (state) => state.first(),
last: (state) => state.last(),
all: (state) => state.toJS(),
});
dispatch(SET, { states: ['CA', 'OR', 'WA'] })
dispatch(SET, { programs: [{ name: 'A', states: ['CA']}] })
dispatch(SET, { selectedState: 'CA' })
t.deepEqual( store.queries.getStates().toJS(), ['CA', 'OR', 'WA'] );
t.deepEqual( store.queries.getPrograms().toJS(), [{ name: 'A', states: ['CA']}] );
t.deepEqual( store.queries.getSelectedState(), 'CA' );
t.deepEqual( store.queries.all(), { states: ['CA', 'OR', 'WA'], programs: [{ name: 'A', states: ['CA']}] , selectedState: 'CA' } );
t.deepEqual( store.queries.has('states'), true );
t.deepEqual( store.queries.first().toJS(), ['CA', 'OR', 'WA'] );
t.deepEqual( store.queries.last(), 'CA' );
t.deepEqual( store.queries.includes('CA'), true );
})
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