Find available & relevant npm package names for your project.
Supposedly:
There are only three hard things in Computer Science: cache invalidation, naming things, off-by-one errors, and being original.
- Phil Karlton et al.¹
¹ original quote is becoming lost to history / legend
namesake
can do absolutely nothing to help you with cache invalidation and
off-by-one errors but it can help you with naming things. Being original is
still up to you.
Check out the command line frontend if you want to use this easily from your terminal.
yarn add namesake
# or
npm i namesake
import namesake from "namesake"
namesake("worth").then(names => {
// `names` is an array of available package names
// they're all guaranteed to be available on npm at time of use
console.log(names)
})
/*
[ "dollar-bill",
"price-floor",
"cheaper",
"billion",
"richest",
"doable",
... ]
*/
namesake(keyword?: string, options = {})
Arguments
{string} [keyword]
: optional keyword to find related terms{NamesakeOptions} [options = {}]
:
key | type | default | description |
---|---|---|---|
limit |
number |
50¹ | Max number of results to return. |
If keyword
is not provided, a random word will be chosen to which
all results will be related.
¹ The max number of words returned isn't guaranteed to be equal to limit
, since
the word list is pulled and then filtered based on npm name availability. The
absolute maximum is 1000, which is imposed by the API.
namesake
will always request more than your desired maximum to try to meet the
provided limit after checking for availability.
Returns
Promise<string[]>
namesake-cli
– the command line frontend to this module- Datamuse API – powers the related word search capabilities
english-words
– word list used here for random word selection
Pull requests and any issues found are always welcome.
- Fork the project, and preferably create a branch named something like
feat/make-better
- Modify the source files as needed
- Make sure all tests continue to pass, and it never hurts to have more tests
- Push & pull request! 🎉
MIT © Bo Lingen / citycide