Nihilist Postmodern Mistake
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

raynor

0.16.0 • Public • Published

Raynor npm version Build Status Coverage License Dependencies

A TypeScript marshalling and data validation library.

See this article for a tutorial and introduction to Raynor.

We'll add more docs with time, but here's a quick example:

class User {
    @MarshalWith(StringMarshaller)
    name: string;
    @MarshalWith(ArrayOf(NumberMarshaller))
    scoresByDay: number[];
 
    totalScore(): number {
        return this.scoresByDay.reduce((a,b) => a + b, 0);
    }
}
 
const um = new (MarshalFrom(User))();
const u = um.extract(JSON.parse('{"name": "Raynor", "scoresByDay": [10, 20, 30]}'));
console.log(u.totalScore()); // Prints 60

install

npm i raynor

Downloadsweekly downloads

129

version

0.16.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability