DEV Community

Gavi Schneider
Gavi Schneider

Posted on • Originally published at Medium on

2 2

Music Genres: My Second NPM Package

In case you haven’t already noticed, I love music. Not the way everyone says they do, I actually love it. So after yesterdays SLAAAYER rush, I quickly dove into my next music-related NPM project: Music Genres.

The package is simple: install and require it, and then you’ll have access to three functions:

  1. getAllGenres()
  2. getRandomGenre()
  3. getRandomSubgenre()

The first will return all the stored genres and sub-genres (of which there are currently 13 and 222, respectively) in a JavaScript Object. The second will Return a random genre, an array holding sub-genres. Lastly, the third will return a random sub-genre, which is a string.

Example

const musicGenres = require("music-genres");

musicGenres.getAllGenres();
// Returns all genres - an object holding genres

musicGenres.getRandomGenre();
// Returns random genre - an array holding sub-genres

musicGenres.getRandomSubgenre();
// Returns random sub-genre - a string
Enter fullscreen mode Exit fullscreen mode

You can install the package here: https://www.npmjs.com/package/music-genres

I’d love any and all feedback. Say hi on twitter @gschnei.

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

While many AI coding tools operate as simple command-response systems, Qodo Gen 1.0 represents the next generation: autonomous, multi-step problem-solving agents that work alongside you.

Read full post

Top comments (2)

Collapse
 
kirensan678 profile image
Kiren San

Editorialcode serves as a guiding Dancehall framework for the organization's journalists, emphasizing the importance of accuracy, fairness, and ethical conduct in their reporting.

Collapse
 
cemkaanguru profile image
cem kaan kosali

Why don't you try to port it to DENO?

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️