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.
License
© 2016 Mumba Pty Ltd. All rights reserved.