elastic / elastic-transport-js

Transport classes and utilities shared among Node.js Elastic client libraries
Apache License 2.0
5 stars 25 forks source link

Added Array.isArray check during redaction #83

Closed ezimuel closed 7 months ago

ezimuel commented 7 months ago

This PR fixes https://github.com/elastic/elasticsearch-js/issues/2128 issue. The issue was related to the conversion of property array into object due to this check:

if (typeof value === 'object' && value !== null) {
  // ...
}

Since typeof of an Array is an object in Javascript (see here) the solution for removing Array in this condition is to use Array.isArray(), as follows:

if (typeof value === 'object' && !Array.isArray(value) && value !== null) {
  // ..
}