0.0.18 • Published 5 years ago

data-reviser v0.0.18

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

Build Status npm version

Features

  1. Validate data type and data structure.
  2. Translate data type.

Build Setup

yarn install    # Dependecies
yarn run dev    # Dev
yarn run build  # Build
yarn run test   # Test

Installation

npm install data-reviser
# or
yarn add data-reviser

Usage

Basic Usage

import { Reviser, TypeInt32, ToInt32 } from 'data-reviser';

class M extends Reviser {
  @ToInt32
  @TypeInt32()
  num = 1;
};

const m = new M();
const message = m.set({ num: '123'});

console.log(message);  // { num: { type: string, message: string }}
console.log(m.get());  // { num: 123 }

Inherit

class N extends M {
  @ToInt32
  str = '';
};

const n = new N();
const message = m.set({ str: 123 });

console.log(message);  // null
console.log(m.get());  // { num: 1, str: '123'}

More example see test case.

API documentation

api

For contributors

TODO

Licence

MIT

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago