Skip to main content

slug

Stentor API Reference


Stentor API Reference / stentor-utils/src / slug

Function: slug()

slug(value, options?): string

Defined in: packages/stentor-utils/src/string/slug.ts:51

Converts a value into a URL safe slug.

This is the single place the slug implementation lives - use it instead of depending on slugify directly so a change in the underlying library is one edit rather than nine.

It throws on a non string value, which is what the call sites rely on to surface bad input.

Parameters​

value​

string

The value to convert.

options?​

SlugProps

The slug options. If it is a string, it is used as the replacement.

Returns​

string