mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: handle no issues in custom analytics (#2226)
This commit is contained in:
parent
1621125f6d
commit
e3793f4464
@ -9,7 +9,6 @@ import { findStringWithMostCharacters } from "helpers/array.helper";
|
|||||||
import { generateBarColor } from "helpers/analytics.helper";
|
import { generateBarColor } from "helpers/analytics.helper";
|
||||||
// types
|
// types
|
||||||
import { IAnalyticsParams, IAnalyticsResponse } from "types";
|
import { IAnalyticsParams, IAnalyticsResponse } from "types";
|
||||||
// constants
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
analytics: IAnalyticsResponse;
|
analytics: IAnalyticsResponse;
|
||||||
|
@ -38,10 +38,13 @@ export const orderArrayBy = (
|
|||||||
|
|
||||||
export const checkDuplicates = (array: any[]) => new Set(array).size !== array.length;
|
export const checkDuplicates = (array: any[]) => new Set(array).size !== array.length;
|
||||||
|
|
||||||
export const findStringWithMostCharacters = (strings: string[]) =>
|
export const findStringWithMostCharacters = (strings: string[]): string => {
|
||||||
strings.reduce((longestString, currentString) =>
|
if (!strings || strings.length === 0) return "";
|
||||||
|
|
||||||
|
return strings.reduce((longestString, currentString) =>
|
||||||
currentString.length > longestString.length ? currentString : longestString
|
currentString.length > longestString.length ? currentString : longestString
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const checkIfArraysHaveSameElements = (arr1: any[] | null, arr2: any[] | null): boolean => {
|
export const checkIfArraysHaveSameElements = (arr1: any[] | null, arr2: any[] | null): boolean => {
|
||||||
if (!arr1 || !arr2) return false;
|
if (!arr1 || !arr2) return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user