diff --git a/lib/grammar-error.js b/lib/grammar-error.js index af831d53..9f06e2b8 100644 --- a/lib/grammar-error.js +++ b/lib/grammar-error.js @@ -2,9 +2,19 @@ // See: https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work // This is roughly what typescript generates, it's not called after super(), where it's needed. -const setProtoOf = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; +const setProtoOf = Object.setPrototypeOf + || ({ __proto__: [] } instanceof Array + && function(d, b) { + // eslint-disable-next-line no-proto + d.__proto__ = b; + }) + || function(d, b) { + for (const p in b) { + if (Object.prototype.hasOwnProperty.call(b, p)) { + d[p] = b[p]; + } + } + }; // Thrown when the grammar contains an error. class GrammarError extends Error {