diff --git a/index.js b/index.js index b4384a7..3165ed1 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,14 @@ // @ts-check 'use strict'; -// NeDB on life support, util.isDate is removed in node 23.x, monkeypatch it -// eslint-disable-next-line global-require -if (!('isDate' in require('util'))) { - // eslint-disable-next-line global-require - require('util').isDate = require('util').types.isDate; +// NeDB on life support +// some util methods are removed in node 23.x, monkeypatch them +const util = require('util'); +const patch_methods = [ 'isDate', 'isRegExp' ]; +for (let i = 0; i < patch_methods.length; i++) { + util[patch_methods[i]] = util.types[patch_methods[i]]; } +util.isArray = Array.isArray; process.chdir(__dirname); require('ts-node').register({ transpileOnly: true });