move utility methods to @/utils

This commit is contained in:
geoffrey45
2022-08-04 18:43:12 +03:00
parent aae7b20c99
commit b9f0368f5b
30 changed files with 244 additions and 158 deletions
+18
View File
@@ -0,0 +1,18 @@
/**
* Turns a list of artists into a string of artists separated by commas.
* @param artists artists array to put commas in
* @returns a string with commas in between each artist
*/
export default (artists: string[]) => {
let result = [];
artists.forEach((i, index, artists) => {
if (index !== artists.length - 1) {
result.push(i + ", ");
} else {
result.push(i);
}
});
return result;
};