denzel v4.1.0
Denzel
Share Data Representations (Models, Collections) between Node and the Browser
Read the DOCS
Why?
Denzel is a toolkit for consistency with the representations of your data between Browsers and Node Servers. It provides methods for creating these representations and for indexing these representations.
Installation
Denzel is available via npm
for Node, and bower
for the Browser
Node
npm i -S denzel
Browser
Denzel has 3 bundles for your convenience:
Minified
const {Model, Collection, Enum} = require('denzel/dist/denzel.min.js');
Un-minified
const {Model, Collection, Enum} = require('denzel/dist/denzel.js');
CommonJS
const {Model, Collection, Enum} = require('denzel/dist/denzel.cjs.js');
You can install denzel via bower with:
bower install denzel
Usage
Read the DOCS
Using in Redux
Classes as state really don't play too well with redux. SEE: Why Not to Store Objects In Redux
In ReactRedux/Vuex
// inside a reducer
switch(action.type) {
case 'LOAD_USERS': {
return new PersonCollection(action.users, User).toArray();
}
default: {
return state
}
}
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago