UNPKG

@cassette/core

Version:

A simple, clean, and responsive visual wrapper for the HTML audio tag, built with React.

13 lines (10 loc) 339 B
import arrayFindIndex from 'array-find-index'; function findTrackIndexByUrl(playlist, url) { return arrayFindIndex(playlist, track => { if (track.sources) { return arrayFindIndex(track.sources, source => source.src === url) !== -1; } return track.url && url === track.url; }); } export default findTrackIndexByUrl;