Packages

README

A Mojo port of NanoID, a tiny, secure, URL-friendly, unique string ID generator.

Features

  • Generates random, unique, URL-friendly IDs
  • Customizable alphabet and length
  • Fast and dependency-free

Installation

Add nanoid to your mojoproject.toml dependencies and install with your preferred Mojo package manager.

Usage

from nanoid import nanoid

# Generate a default 12-character ID
id = nanoid()
print(id)

# Generate a 21-character ID
id = nanoid[length=21]()
print(id)

# Generate an ID with a custom alphabet
id = nanoid[length=10](alphabet="abcdef123456")
print(id)

Testing

Run the included test with:

magic run test

License

Apache 2.0. See LICENSE for details.

DETAILS

RUN (INSTALL MAX FIRST)

magic add nanoid

MAX VERSION COMPATIBILITY

max=25.3

CREATED BY

TAGS

strings
Submit your own package