modella-friendly-errors

0.1.1 • Public • Published

modella-friendly-errors

Because what the hell does PC Loadletter mean?

Example Usage

var User = modella('User') .attr('password') .attr('passwordConfirmation', { friendlyName: 'Password confirmation'})

User.use(require('modella-friendly-errors'));

// In reality a validator would probably do this, but for sake of demo... var u = new User(); u.error('password', 'can not be blank'); u.error('passwordConfirmation', 'must match password');

u.friendlyErrors() // => // [ { attr: 'password', message: 'can not be blank' }, { attr: 'passwordConfirmation', friendlyName: 'Password confirmation', message: 'must match password'} ]

u.errorMessages() // => // [ 'Password can not be blank', 'Password confirmation must match password' ];

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    4
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    4
  • 0.1.0
    2

Package Sidebar

Install

npm i modella-friendly-errors

Weekly Downloads

5

Version

0.1.1

License

MIT

Last publish

Collaborators

  • rschmukler