mumba-errors

A set of classes for managing lists of errors.


Keywords
errors, error list, validate, validation, validation errors, typescript
License
Apache-2.0
Install
npm install mumba-errors@0.1.0

Documentation

build status coverage report

Mumba Errors

A set of classes for managing lists of errors.

Installation

$ npm install --save mumba-errors

Examples

import {ValidationErrors} from 'mumba-errors';

let data = {
	title: 'foo'
};
let errors = new ValidationErrors();

if (data.title.length < 8) {
	errors.minLength('title', 8);
}

if (errors.any()) {
	console.log(JSON.stringify(errors, null, 2));
}

Outputs:

{
  "$errors": [
    {
      "property": "title",
      "type": "length.minimum",
      "expects": 8
    }
  ]
}

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

People

The original author of Mumba Errors is Andrew Eddie.

List of all contributors

License

Apache 2.0


© 2016 Mumba Pty Ltd. All rights reserved.