mumba-errors
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

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.

Package Sidebar

Install

npm i mumba-errors

Weekly Downloads

1

Version

0.1.6

License

Apache-2.0

Last publish

Collaborators

  • arvin.domingo
  • dennis.barbamumba
  • mumba.cloud
  • carl-oehme-mumba
  • kennbaker