Update fnTools.ts
This commit is contained in:
parent
a330ffa653
commit
6a2ee0b2df
@ -191,3 +191,17 @@ export function arrayFilesToFileList(filesList) {
|
|||||||
return dataTransfer;
|
return dataTransfer;
|
||||||
}, new DataTransfer()).files;
|
}, new DataTransfer()).files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a copy of the Array by swapping 2 indices.
|
||||||
|
* @param {number} firstIndex
|
||||||
|
* @param {number} secondIndex
|
||||||
|
* @param {Array<any>} list
|
||||||
|
*/
|
||||||
|
export function arraySwapIndex(firstIndex: number, secondIndex: number, list: Array<any>): Array<any> {
|
||||||
|
const tempList = list.slice();
|
||||||
|
const tmpFirstPos = tempList[firstIndex];
|
||||||
|
tempList[firstIndex] = tempList[secondIndex];
|
||||||
|
tempList[secondIndex] = tmpFirstPos;
|
||||||
|
return tempList;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user