@whi/into-struct
v0.3.1
Published
Validate and/or convert input based on a given struct definition
Downloads
95
Readme
Into Struct
This package is intended to validate and/or convert input against a given struct definition.
Overview
Install
npm i @whi/into-struct
Usage
import { intoStruct } from '@whi/into-struct';
const PostStruct = {
"message": String,
"tags": VecType( String ),
"published_at": Number,
"last_updated": Number,
};
const post = intoStruct({
"message": "Hello, world!",
"tags": [ "greeting" ],
"published_at": Date.now(),
"last_updated": Date.now(),
}, PostStruct );
Contributing
See CONTRIBUTING.md