Skip to content
forked from horia141/raynor

A TypeScript marshalling and validation library

License

Notifications You must be signed in to change notification settings

stephensong/raynor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raynor npm version Build Status Coverage

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

About

A TypeScript marshalling and validation library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%