<commit_before>
import '../polyfills';
import * as rev from '../index';

// EXAMPLE:
// import * as rev from 'rev-models'

let TITLES = [
    ['Mr', 'Mr.'],
    ['Mrs', 'Mrs.'],
    ['Miss', 'Miss.'],
    ['Dr', 'Dr.']
];

export class Person {
    title: string;
    first_name: string;
    last_name: string;
    age: number;

    email: string;
    newsletter: boolean;
}

rev.register(Person, {
    fields: [
        new rev.SelectionField('title', 'Title', TITLES, { required: false }),
        new rev.TextField('first_name', 'First Name'),
        new rev.TextField('last_name', 'Last Name'),
        new rev.IntegerField('age', 'Age', { required: false }),
        new rev.EmailField('email', 'Email'),
        new rev.BooleanField('newsletter', 'Registered for Newsletter?')
    ]
});
<commit_msg>Update example to use Decorators<commit_after>
import '../polyfills';
import * as m from '../index';

// EXAMPLE:
// import * as rev from 'rev-models'


let TITLES = [
    ['Mr', 'Mr.'],
    ['Mrs', 'Mrs.'],
    ['Miss', 'Miss.'],
    ['Dr', 'Dr.']
];

export class Person {

    @m.SelectionField('Title', TITLES, { required: false })
        title: string;
    @m.TextField('First Name')
        first_name: string;
    @m.TextField('Last Name')
        last_name: string;
    @m.IntegerField('Age', { required: false })
        age: number;

    @m.EmailField('Email')
        email: string;
    @m.BooleanField('Registered for Newsletter?')
        newsletter: boolean;
}

m.register(Person);

{'fraction_non_alphanumeric': 0.18562874251497005, 'fraction_numerical': 0.0, 'mean_word_length': 2.778894472361809, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3850811', 'n_tokens_mistral': 503, 'n_tokens_neox': 490, 'n_words': 127}