Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const getHighlightedIndexes = ({
start,
end,
indexes,
items,
hoveredIndex,
}: GetHighlightedIndexesParams) => {
const max = items.length - 1;
const groupIndexes = isValidIndex(start)
? range(
clamp({ min: 0, max, value: start }),
clamp({ min: 0, max, value: isValidIndex(end) ? end : start }),
)
: [];
const hoveredIndexes = isValidIndex(hoveredIndex) ? [hoveredIndex] : [];
return uniqueArray([...hoveredIndexes, ...indexes, ...groupIndexes], true);
};
export const getHighlightedIndexes = ({
start,
end,
indexes,
items,
hoveredIndex,
}: GetHighlightedIndexesParams) => {
const max = items.length - 1;
const groupIndexes = isValidIndex(start)
? range(
clamp({ min: 0, max, value: start }),
clamp({ min: 0, max, value: isValidIndex(end) ? end : start }),
)
: [];
const hoveredIndexes = isValidIndex(hoveredIndex) ? [hoveredIndex] : [];
return uniqueArray([...hoveredIndexes, ...indexes, ...groupIndexes], true);
};
public rectangle(spacing = 60): [HSL, HSL, HSL, HSL] {
spacing = clamp({ min: 0, max: 180, value: spacing });
return [this, this.rotate(spacing), this.rotate(180), this.rotate(180 + spacing)];
}