Skip to content

Commit

Permalink
updated array check for cross window functionality (#995)
Browse files Browse the repository at this point in the history
  • Loading branch information
malmgrens4 authored Nov 15, 2024
1 parent 95a7f4b commit 1b467e7
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const matchesRoute = ({
)
} else if (
routeInfo.routeProps.path &&
routeInfo.routeProps.path.constructor === Array
Array.isArray(routeInfo.routeProps.path)
) {
return routeInfo.routeProps.path.some(
(possibleRoute) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ function hasValidShape({
}: {
value: BasicDatatypeFilter['value']
}): boolean {
if (value === undefined || value === null || value.constructor !== Array) {
if (value === undefined || value === null || !Array.isArray(value)) {
return false
} else {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ const AttributeComponent = ({
if (value === undefined || value === null) {
value = []
}
if (value.constructor !== Array) {
if (!Array.isArray(value)) {
value = [value]
}
const { getAlias, getType } = useMetacardDefinitions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export const Histogram = ({ selectionInterface }: Props) => {
const matchedResults = findMatchesForAttributeValues(
results,
attributeToBin,
category.constructor === Array ? category : [category]
Array.isArray(category) ? category : [category]
)

if (
Expand Down Expand Up @@ -484,7 +484,7 @@ export const Histogram = ({ selectionInterface }: Props) => {
findMatchesForAttributeValues(
activeSearchResults,
attributeToCheck,
category.constructor === Array ? category : [category]
Array.isArray(category) ? category : [category]
)
)
return results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ export default function CesiumMap(
Options passed in are color and isSelected.
*/
updateCluster(geometry: any, options: any) {
if (geometry.constructor === Array) {
if (Array.isArray(geometry)) {
geometry.forEach((innerGeometry) => {
this.updateCluster(innerGeometry, options)
})
Expand Down Expand Up @@ -1122,7 +1122,7 @@ export default function CesiumMap(
Options passed in are color and isSelected.
*/
updateGeometry(geometry: any, options: any) {
if (geometry.constructor === Array) {
if (Array.isArray(geometry)) {
geometry.forEach((innerGeometry) => {
this.updateGeometry(innerGeometry, options)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ const handleMapHover = ({
Boolean(
mapEvent.mapTarget &&
mapEvent.mapTarget !== 'userDrawing' &&
(mapEvent.mapTarget.constructor === Array ||
(Array.isArray(mapEvent.mapTarget) ||
(mapEvent.mapTarget.constructor === String &&
!(mapEvent.mapTarget as string).startsWith(SHAPE_ID_PREFIX)))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function translateFromOpenlayersCoordinates(coords: CoordinatesType) {
export function translateToOpenlayersCoordinates(coords: CoordinatesType) {
const coordinates = [] as CoordinatesType
coords.forEach((item) => {
if (item[0].constructor === Array) {
if (Array.isArray(item[0])) {
coordinates.push(
translateToOpenlayersCoordinates(
item as unknown as CoordinatesType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export default function (
this.panToExtent(coordinates)
},
panToExtent(coords: [number, number][]) {
if (coords.constructor === Array && coords.length > 0) {
if (Array.isArray(coords) && coords.length > 0) {
const lineObject = coords.map((coordinate) =>
convertPointCoordinate(coordinate)
)
Expand Down Expand Up @@ -810,7 +810,7 @@ export default function (
Options passed in are color and isSelected.
*/
updateCluster(geometry: any, options: any) {
if (geometry.constructor === Array) {
if (Array.isArray(geometry)) {
geometry.forEach((innerGeometry) => {
this.updateCluster(innerGeometry, options)
})
Expand Down Expand Up @@ -856,7 +856,7 @@ export default function (
Options passed in are color and isSelected.
*/
updateGeometry(geometry: any, options: any) {
if (geometry.constructor === Array) {
if (Array.isArray(geometry)) {
geometry.forEach((innerGeometry) => {
this.updateGeometry(innerGeometry, options)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ const RowComponent = ({
if (value === undefined) {
value = ''
}
if (value.constructor !== Array) {
if (!Array.isArray(value)) {
value = [value]
}
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ export const ResultItem = ({
if (value && MetacardDefinitions.getAttributeMap()[detail]) {
switch (MetacardDefinitions.getAttributeMap()[detail].type) {
case 'DATE':
if (value.constructor === Array) {
if (Array.isArray(value)) {
value = value.map((val: any) =>
TypedUserInstance.getMomentDate(val)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const convertToBackendCompatibleForm = ({
const duplicatedProperties = _cloneDeep(properties)
Object.keys(duplicatedProperties).forEach((key) => {
if (typeof duplicatedProperties[key] !== 'string') {
if (duplicatedProperties[key]?.constructor === Array) {
if (Array.isArray(duplicatedProperties[key])) {
duplicatedProperties[key] = (duplicatedProperties[key] as any[]).map(
(value) => {
if (typeof value === 'object') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { LazyQueryResult } from './LazyQueryResult'
import { QuerySortType } from './types'

function parseMultiValue(value: any) {
if (value && value.constructor === Array) {
if (value && Array.isArray(value)) {
return value[0]
}
return value
Expand Down

0 comments on commit 1b467e7

Please sign in to comment.