playlistjs

because lists are boring

GitHub

Create dynamic playlists with TypeScript:

// Create a playlist of one song
const neverGonnaGiveYouUp = 'dQw4w9WgXcQ';
Playlist.yield([neverGonnaGiveYouUp]);

// Loop forever
Playlist.yield(function*() {
    while(true) {
        yield neverGonnaGiveYouUp;
    }
});

// Graphs
Playlist.yield(function*() {
    let head = neverGonnaGiveYouUp;
    do {
        yield head;
    } while(
        head = graph.getEdgesFrom(head).pick((edge) => (
            edge.weight
        ))
    );
})