UNPKG

@leismore/unknown2error

Version:

The function converts anything into an object of Error (or subclasses) class. If `error` is an object of Error (or subclasses) class, it returns the original `error` object. With any other type, it will convert it into a string first and then an Error obj

6 lines (5 loc) 180 B
/** * Function unknown2error - Convert anything into an Error (or subclasses of Error) object. */ declare function unknown2error(anything: any): Error; export { unknown2error };