mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-29 05:07:49 +00:00
hotfix: also patch util.isRegExp and util.isArray
This commit is contained in:
parent
d1b686a991
commit
e951497c71
12
index.js
12
index.js
@ -1,12 +1,14 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// NeDB on life support, util.isDate is removed in node 23.x, monkeypatch it
|
// NeDB on life support
|
||||||
// eslint-disable-next-line global-require
|
// some util methods are removed in node 23.x, monkeypatch them
|
||||||
if (!('isDate' in require('util'))) {
|
const util = require('util');
|
||||||
// eslint-disable-next-line global-require
|
const patch_methods = [ 'isDate', 'isRegExp' ];
|
||||||
require('util').isDate = require('util').types.isDate;
|
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);
|
process.chdir(__dirname);
|
||||||
require('ts-node').register({ transpileOnly: true });
|
require('ts-node').register({ transpileOnly: true });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user