0.1.0 • Published 6 years ago

simple-redux-normalizr v0.1.0

Weekly downloads
13
License
MIT
Repository
github
Last release
6 years ago

simple-redux-normalizr

Get Started

npm install simple-redux-normalizr --save

Example

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');
0.1.0

6 years ago

0.0.2-3

7 years ago

0.0.2-2

7 years ago

0.0.2-1

7 years ago

0.0.2-0

7 years ago

0.0.1

7 years ago