mathjs
Version:
Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif
28 lines (20 loc) • 400 B
JavaScript
/*
MIT License http://www.opensource.org/licenses/mit-license.php
*/
;
class ErrorObjectSerializer {
constructor(Type) {
this.Type = Type;
}
serialize(obj, { write }) {
write(obj.message);
write(obj.stack);
}
deserialize({ read }) {
const err = new this.Type();
err.message = read();
err.stack = read();
return err;
}
}
module.exports = ErrorObjectSerializer;