From 3f1e65eb9ed37b22039bd2624cee1faaee0b3630 Mon Sep 17 00:00:00 2001 From: Rami <72725910+ramikg@users.noreply.github.com> Date: Sun, 3 Nov 2024 15:42:48 +0200 Subject: [PATCH] Replace deprecated usages of `util.isDate` & `util.isString` --- lib/metadata/index.js | 2 +- lib/types/local-time.js | 2 +- lib/utils.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/metadata/index.js b/lib/metadata/index.js index ec587fcaf..a34c45708 100644 --- a/lib/metadata/index.js +++ b/lib/metadata/index.js @@ -391,7 +391,7 @@ class Metadata { if (Array.isArray(components)) { return this.tokenizer.hash(Buffer.concat(components)); } - else if (util.isString(components)) { + else if (typeof components === "string") { return this.tokenizer.parse(components); } return this.tokenizer.hash(components); diff --git a/lib/types/local-time.js b/lib/types/local-time.js index 2b726cf23..0e320cc98 100644 --- a/lib/types/local-time.js +++ b/lib/types/local-time.js @@ -124,7 +124,7 @@ LocalTime.now = function (nanoseconds) { * @returns {LocalTime} */ LocalTime.fromDate = function (date, nanoseconds) { - if (!util.isDate(date)) { + if (!(date instanceof Date)) { throw new Error('Not a valid date'); } //Use the local representation, only the milliseconds portion diff --git a/lib/utils.js b/lib/utils.js index 1ce7c4b58..395f122cd 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -213,7 +213,7 @@ function deepExtend(target) { targetType === 'number' || targetType === 'string' || Array.isArray(targetProp) || - util.isDate(targetProp) || + targetProp instanceof Date || targetProp.constructor.name !== 'Object') { target[prop] = source[prop]; }