From 5b6f8699622f6a362c460e4e64353fe3c42b8ef5 Mon Sep 17 00:00:00 2001 From: Mihkel Martin Kasterpalu Date: Tue, 21 Jan 2025 13:10:24 +0200 Subject: [PATCH] Add sources for external code --- src/lib/utils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 5d47c69..87577a1 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -5,6 +5,7 @@ export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } +// https://perryjanssen.medium.com/getting-random-tracks-using-the-spotify-api-61889b0c0c27 export function getRandomSearch() { // A list of all characters that can be chosen. const characters = 'abcdefghijklmnopqrstuvwxyz'; @@ -26,6 +27,7 @@ export function getRandomSearch() { return randomSearch; } +// Created using Claude 3.5 Sonett export function shuffleObjectValues(arr: Array): Array { // Create a copy of the array const copy = structuredClone(arr); @@ -52,6 +54,7 @@ export function shuffleObjectValues(arr: Array): Array { return copy; } +// https://stackoverflow.com/a/12646864 export function shuffleArray(array: T[]): T[] { for (let i = array.length - 1; i >= 0; i--) { const j = Math.floor(Math.random() * (i + 1)); @@ -61,6 +64,7 @@ export function shuffleArray(array: T[]): T[] { return array; } +// Created using Claude 3.5 Sonett export function truncate(text: string, maxLength: number): string { // Return original text if it's shorter than or equal to maxLength if (text.length <= maxLength) {