codename

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 4 Imported by: 0

README

xk6-codename

Generate random, pronounceable codenames

Usage

For convenient use, the default export of the module is a codename() function, it just needs to be imported and it is ready for use.

import codename from "k6/x/codename";

export default function () {
  console.log(`Hello, ${codename()}`); # Hello, mint-bishop
}

The examples directory contains examples of how to use the xk6-codename extension. A k6 binary containing the xk6-codename extension is required to run the examples.

If the search path also contains the k6 command, don't forget to specify which k6 you want to run (for example ./k6).

API

The API consists of only one function:

  • codename(): generate a codename

The default export of the module is the codename() function.

import codename from "k6/x/codename";

export default function () {
  console.log(`Hello, ${codename(4)}`); # Hello, rich-humbug-787b
}

The function has an optional parameter, the length of the token. If this is not zero, then the generated name is supplemented with a randomly generated hexadecimal token of the specified length. Using a token reduces the probability of name collisions.

Build

The xk6 build tool can be used to build a k6 that will include xk6-codename extension:

xk6 build --with codeberg.org/szkiba/xk6-codename@latest

For more build options and how to use xk6, check out the xk6 documentation.

Documentation

Overview

Package codename is a xk6-codename extension module.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL