Node package for generating family-friendly usernames
The author of a platform that recently gained 1000 users has received feedback to add a feature that requires usernames. They tried using the npm package "unique-username-generator" with the format ${adjective}_${noun}
but found that many of the generated usernames were questionable or negative, which did not fit the platform's family-friendly image.
The author is now searching for a package that generates unique usernames with more positive adjectives. While they could create their own dictionary of words to use with the package, they would prefer to use a package that already includes positive adjectives.
Fortunately, there are several npm packages available for generating unique and family-friendly usernames. One such package is "friendly-words", which includes a list of 5,000 common English words that are easy to spell and pronounce. The package allows users to generate random usernames with the format ${adjective}_${noun}
, or they can use the package's built-in functions to generate usernames with different formats.
Here's an example of how to use "friendly-words" to generate a random username:
const friendlyWords = require('friendly-words');
const username = `${friendlyWords.predicates[Math.floor(Math.random() * friendlyWords.predicates.length)]}_${friendlyWords.objects[Math.floor(Math.random() * friendlyWords.objects.length)]}`;
console.log(username); // Output: "happy_donkey"
Other npm packages that offer similar functionality include "random-username-generator" and "username-generator". By using these packages, developers can ensure that their platforms have family-friendly usernames that fit their brand image.