datatyper

0.0.1 • Public • Published

DataTyper

Realtime data-type watcher

CDN

https://unpkg.com/datatyper
# or
https://npmcdn.com/datatyper
# or
https://cdn.jsdelivr.net/npm/datatyper

Usage

import { TypedTree, Types } from 'datatyper'

// Types
console.log(Types)


let typer = new TypedTree({a:1}, {types:{a:'Integer'},required:{b:true}}, true /* warning show flag */)

setTimeout(() => typer.set('a', 1.5), 1000) // logs error via `console.error` if avaiable, first for property:a and second for required b property
setTimeout(() => {
    typer.set('b', 2) // Property:b type is undefined, so any. And not anymore shows error for required flag
}, 2000)

Package Sidebar

Install

npm i datatyper

Weekly Downloads

4

Version

0.0.1

License

MIT

Last publish

Collaborators

  • dalisoft