Skip to content

Find available & relevant npm package names for your project.

License

Notifications You must be signed in to change notification settings

haltcase/namesake

Repository files navigation

namesake · Version License

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.

installation

yarn add namesake

# or

npm i namesake

usage

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",
  ... ]
*/

api

namesake

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[]>

see also

contributing

Pull requests and any issues found are always welcome.

  1. Fork the project, and preferably create a branch named something like feat/make-better
  2. Modify the source files as needed
  3. Make sure all tests continue to pass, and it never hurts to have more tests
  4. Push & pull request! 🎉

license

MIT © Bo Lingen / citycide