From 8a9a3fba097df799c05b73c757a00e636de66015 Mon Sep 17 00:00:00 2001 From: Andrei Troskov Date: Tue, 21 Oct 2025 11:10:21 +0300 Subject: [PATCH] Replace deprecated util.isArray with Array.isArray --- lib/profile_helpers.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/profile_helpers.js b/lib/profile_helpers.js index ec1758e7..0465c873 100644 --- a/lib/profile_helpers.js +++ b/lib/profile_helpers.js @@ -2,7 +2,6 @@ * Mixin with profile-related helpers (for people and groups) */ -const util = require('util'); const {ensure_timestamp} = require('./utils'); function merge_modifiers(data, modifiers) { @@ -103,7 +102,7 @@ exports.ProfileHelpers = (Base = Object) => class extends Base { _remove({identifiers, data, modifiers, callback}) { let $remove = {}; - if (typeof(data) !== 'object' || util.isArray(data)) { + if (typeof(data) !== 'object' || Array.isArray(data)) { if (this.config.debug) { this.mixpanel.config.logger.error("Invalid value passed to #remove - data must be an object with scalar values"); } @@ -153,7 +152,7 @@ exports.ProfileHelpers = (Base = Object) => class extends Base { _union({identifiers, data, modifiers, callback}) { let $union = {}; - if (typeof(data) !== 'object' || util.isArray(data)) { + if (typeof(data) !== 'object' || Array.isArray(data)) { if (this.config.debug) { this.mixpanel.config.logger.error("Invalid value passed to #union - data must be an object with scalar or array values"); } @@ -161,7 +160,7 @@ exports.ProfileHelpers = (Base = Object) => class extends Base { } for (const [key, val] of Object.entries(data)) { - if (util.isArray(val)) { + if (Array.isArray(val)) { var merge_values = val.filter(function(v) { return typeof(v) === 'string' || typeof(v) === 'number'; }); @@ -209,7 +208,7 @@ exports.ProfileHelpers = (Base = Object) => class extends Base { _unset({identifiers, prop, modifiers, callback}){ let $unset = []; - if (util.isArray(prop)) { + if (Array.isArray(prop)) { $unset = prop; } else if (typeof(prop) === 'string') { $unset = [prop];