mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
move utility methods to @/utils
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user