
Security News
Python Adopts Standard Lock File Format for Reproducible Installs
Python has adopted a standardized lock file format to improve reproducibility, security, and tool interoperability across the packaging ecosystem.
Namor.js is a name generator for Node that creates random, url-friendly names. This comes in handy if you need to generate unique subdomains like many PaaS/SaaS providers do, or unique names for anything else.
See it in action. Also available for Elixir.
Please Note: Generated names are not always guaranteed to be unique. To reduce the chances of collision, you can increase the length of the trailing number (see here for collision stats). Always be sure to check your database before assuming a generated value is unique.
$ npm install namor
import namor from "namor"
namor.generate()
// "sandwich-invent"
namor.generate({ salt: 5 })
// "sandwich-invent-s86uo"
namor.generate({ words: 3, dictionary: "rugged" })
// "savage-whiskey-stain"
The following stats give you the total number of permutations based on the word count (without a salt), and can help you make a decision on how long to make your salt. This data is based on the number of words we currently have in our dictionary files.
default
dictionaryrugged
dictionaryGenerates a new name, in all its glory.
options
words default: 2
The number of words to include in the generated name. Must be a positive integer no higher than 4.
separator default: "-"
The character to use between words when generating a name.
salt default: 0
The number of characters in the trailing salt. Must be a positive integer.
saltType default: "mixed"
The type of characters to use for the trailing salt. Can be numbers
, letters
, or mixed
.
dictionary default: "default"
The dictionary to use. Can be set to "default"
, "rugged"
, or a custom dictionary using getDict
.
Checks whether a string is valid for use as a subdomain including special characters, length (max of 63 characters), and checking against a list of reserved subdomains.
name - The name to check.
options
default: false
Whether to check the name against the reserved word list, which is a predefined set of values that shouldn't be offered as subdomains. This can also be set to an array of strings for a custom reserved word list (consider using getDictFile
).Reads word lists from a base folder and returns a parsed dictionary object. A dictionary folder is expected to be a directory containing three files: adjectives.txt
, nouns.txt
, and verbs.txt
. Each file should have one word per line with no duplicate words. If basePath
is not defined, it will look for the dictionary in Namor's internal dictionary folder. Use this function to define a custom dictionary like so:
┌── dictionaries/
│ ┌── custom/
│ │ ┌── adjectives.txt
│ │ ├── nouns.txt
│ │ └── verbs.txt
const dictionaryPath = path.resolve(__dirname, "dictionaries")
const dictionary = namor.getDict("custom", dictionaryPath)
namor.generate({ dictionary: dictionary })
Reads a single word file with one word per line, and returns the words trimmed and parsed into an array. If basePath
is not defined, it will look for the dictionary in Namor's internal dictionary folder. Use this function to define a custom reserved word list like so:
┌── dictionaries/
│ ┌── reserved.txt
const dictionaryPath = path.resolve(__dirname, "dictionaries")
const reservedWords = namor.getDictFile("reserved.txt", dictionaryPath)
namor.valid_subdomain("value", { reserved: reservedWords })
Reading large word lists can be slow, so it's very highly recommended to only call getDict
and getDictFile
once when the application starts.
v3.0.1
rawData
accessFAQs
A subdomain-safe name generator
The npm package namor receives a total of 11,689 weekly downloads. As such, namor popularity was classified as popular.
We found that namor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Python has adopted a standardized lock file format to improve reproducibility, security, and tool interoperability across the packaging ecosystem.
Security News
OpenGrep has restored fingerprint and metavariable support in JSON and SARIF outputs, making static analysis more effective for CI/CD security automation.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.