diff --git a/test/visit.js b/test/visit.js index 5b9113b..ca93f61 100644 --- a/test/visit.js +++ b/test/visit.js @@ -109,7 +109,7 @@ describe('visit', () => { assert.fail(); } catch (err) { assert.strictEqual(err, errTest); - assert(!hasOwnProperty.call(err, 'transformPath')); + assert(!Object.hasOwn(err, 'transformPath')); assert.deepStrictEqual(transformPath, []); } }); diff --git a/visit.js b/visit.js index 87af410..adaa1c4 100644 --- a/visit.js +++ b/visit.js @@ -31,7 +31,7 @@ function visit(transformer, method, propName, ...args) { return method.apply(transformer, args); } catch (err) { handlingException = true; - if (err instanceof Error && !hasOwnProperty.call(err, 'transformPath')) { + if (err instanceof Error && !Object.hasOwn(err, 'transformPath')) { err.transformPath = [...transformer.transformPath]; err.message += ` (while transforming ${toJsonPointer(err.transformPath)})`;