delete function module

better to have that stuff in tmdb
This commit is contained in:
andrzej 2024-05-08 16:52:25 +02:00
parent 562f91f61c
commit a70ddebc8a
1 changed files with 0 additions and 22 deletions

View File

@ -1,22 +0,0 @@
/**
* Move array item from provided index to specified index
* @remarks 'to' index refers to position in original array, i.e. if to > from, to = to -1
* @param array
* @param from - the index of the item we want moved
* @param to - the index we want the item moved to
* @returns The modified array
*
* @beta
*/
export function relocateArrayItem(array: Array<any>, from: number, to: number) {
const newArray = structuredClone(array)
const element = newArray.splice(from, 1)[0]
newArray.splice(to < from ? to : to - 1, 0, element)
console.log("reordered array: ")
console.log(newArray)
return newArray
}
/**
* Returns a complete tmdb image url
*/