UNPKG

@neo-one/utils

Version:

NEO•ONE shared utils.

32 lines (30 loc) 973 B
// tslint:disable // @ts-ignore function inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass != null) { throw new TypeError('Super expression must either be null or a function'); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true, }, }); if (superClass) { Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : (subClass.__proto__ = superClass); } } export let CustomError: typeof Error = (function(_super) { inherits(CustomError, _super); function CustomError() { // @ts-ignore var _newTarget = this.constructor; // @ts-ignore var _this = _super.apply(this, arguments); // 'Error' breaks prototype chain here _this.__proto__ = _newTarget.prototype; // restore prototype chain return _this; } return CustomError; })(Error) as any;