junction-normalizr-decorator
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

Junction Normalizr Decorator

Build Status Code Coverage

Map your Junction entity schema to an output suitable for normalizr

Install

npm install junction-normalizr-decorator --save

Usage

Decorate your schema-defined entities with @normalizable([options]) and access the normalizr schema via the normalizedSchema getter. The options parameter, if provided, is passed as the second argument to the normalizr schema.

@normalizable()
class Car {

  wheels = 4;
  electric = true;

}

Car.schema = {
  type: 'entity',
  props: {
    wheels: {
      type: 'number',
      isRequired: true
    },
    electric: {
      type: 'boolean',
      isRequired: true
    }
  }
}

const response = normalize(fetchCars(), Car.normalizedSchema);

Licence

MIT

Package Sidebar

Install

npm i junction-normalizr-decorator

Weekly Downloads

3

Version

0.3.3

License

MIT

Unpacked Size

167 kB

Total Files

19

Last publish

Collaborators

  • andy-shea