Skip to content

mjbrisebois/js-into-struct

Repository files navigation

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

About

Validate and/or convert input based on a given struct definition

Resources

Stars

Watchers

Forks

Packages

No packages published