Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emersonlaurentino/simple-redux-normalizr
:space_invader: Normalizes and denormalizes Arrays for Redux
https://github.com/emersonlaurentino/simple-redux-normalizr
api denormalize flux json normalize normalizr redux
Last synced: 11 days ago
JSON representation
:space_invader: Normalizes and denormalizes Arrays for Redux
- Host: GitHub
- URL: https://github.com/emersonlaurentino/simple-redux-normalizr
- Owner: emersonlaurentino
- License: mit
- Created: 2017-07-29T18:06:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-23T08:49:38.000Z (almost 6 years ago)
- Last Synced: 2024-04-24T01:42:12.622Z (7 months ago)
- Topics: api, denormalize, flux, json, normalize, normalizr, redux
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/simple-redux-normalizr
- Size: 37.1 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-redux-normalizr
## Get Started
```
npm install simple-redux-normalizr --save
```## Example
```js
import { normalize, denormalize, getItem } from 'simple-redux-normalizr';const arr = [
{ id: '32o8wafe', name: 'mark', company: 'facebook' },
{ id: 'oaiwefjo', name: 'musk', company: 'tesla' },
{ id: '3oij2e3c', name: 'jobs', company: 'apple' },
];// {32o8wafe: Object, oaiwefjo: Object, 3oij2e3c: Object}
const normalized = normalize(arr, 'id');// [Object, Object, Object]
const denormalized = denormalize(normalized);// {id: "oaiwefjo", name: "musk", company: "tesla"}
const getFullObj = getItem(normalized, 'oaiwefjo');// tesla
const getItemOfObj = getItem(normalized, 'oaiwefjo', 'company');
```