slugOffunction
An address-safe id from a text: lower-case ASCII letters and digits in runs joined by one hyphen; an accent is dropped (Boötes gives bootes) and a Greek letter is spelt out (α1 Centauri gives alpha1-centauri).
Import it
import { slugOf } from "@johnmorrisdotca/hoshi-stars/names";
Also exported from: @johnmorrisdotca/hoshi-stars/names/named, @johnmorrisdotca/hoshi-stars/names/ngc-ic
Definition
function slugOf(text: string): string
Parameters
| Name | Type | Description |
|---|---|---|
text | string | Any text. |
Returns
string
The id: letters, digits and hyphens only, or an empty string if the text has none.
Examples
import { slugOf } from "@johnmorrisdotca/hoshi-stars/names";
console.log(slugOf("Rigil Kentaurus"), slugOf("α Orionis"));rigil-kentaurus alpha-orionisWhat it prints (run when this page was built)