2.0.2 • Published 6 years ago

model-errors v2.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

model-errors

Add errors to a model.

Getting started

npm install model-errors --save
const ModelErrors = require('model-errors')

class Post {
  constructor(param) {
    this.errors = new ModelErrors()
  }
}
<% if (post.errors.exists) { %>
  <section class="row">
    <div class="col">
      <div class="alert alert-danger">
        <h5>
          The form contains <b><%= post.errors.count %></b> errors.
        </h5>

        <ul>
          <% for (let i=0; i < post.errors.count; i++) { %>
            <li>
              <%= post.errors.messages[i] %>
            </li>
          <% } %>
        </ul>
      </div>
    </div>
  </section>
<% } %>

Changelog

Get the project's history in CHANGELOG.md.

Maintainer

Andy Bettisworth andy@accreu.com https://andybettisworth.com

License

This project is released under the MIT License.

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago