requireRef()function

requireRef(str: string, caller: AnyCaller = requireRef): string
ParamType
strstring
The string to convert. required
callerAnyCaller
Function to attribute a thrown error to (defaults to requireRef itself). Defaults to requireRef
Return
string
The ref.
Throws
RequiredError
If conversion resulted in an empty string.

Convert a string to a unique ref e.g. abc123, or throw RequiredError if conversion resulted in an empty string.

Examples

requireRef("Hello World!") // "helloworld"