Create an error from an array of error messages
npm install array-to-error




Create an error from an array of error messages
``javascript
const arrayToError = require('array-to-error');
const error = arrayToError(['tranling comma on line 1', 'unexpected "(" on line 2']);
error.message; //=> 'tranling comma on line 1\nunexpected "(" on line 2'
error.reasons; //=> ['tranling comma on line 1', 'unexpected "(" on line 2']
`
#### npm
``
npm install array-to-error
#### Bower
``
bower install array-to-error
`javascript`
const arrayToError = require('array-to-error');
messages: Array of strings Object
constructor: (One of the error constructors. Error by default) Object
Return: (error instance)
It returns an instance of error whose message is made from its first argument joined with \n, and has an additional reasons property, the same value as its first argument.
The second argument is used as an error constructor.
`javascript
const arrayToError = require('array-to-error');
const error = arrayToError(['foo', 'bar'], TypeError);
error.message; //=> 'foo\nbar'
error.reasons; //=> ['foo', 'bar']
error.constructor; //=> TypeError
``
Copyright (c) 2015 - 2016 Shinnosuke Watanabe
Licensed under the MIT License.