Reference / @open-music-sdk/core / hostsOf
Function: hostsOf()
function hostsOf(
fn,
value,
example
): readonly string[] | undefined;Defined in: packages/core/src/hosts.ts:24
The hosts a caller allows, as a list of this call's own, or undefined when none were named. Each is a bare host name in small letters, as a URL parser gives a host: https://mzstatic.com, *.mzstatic.com and MzStatic.com would each match nothing, so they are refused here and not left to refuse every URL later. fn is who a mistake is named for, and example a host to show in the error, such as mzstatic.com.
Parameters
fn
string
The name of the function the hosts were handed to, for the error.
value
unknown
What the caller gave as hosts: a list of 1 to 16 host names, or undefined for none.
example
string
A host name to show in the error, such as mzstatic.com.
Returns
readonly string[] | undefined
The hosts as a list of this call's own, or undefined when none were named.
Throws
TypeError if value is neither undefined nor a list of 1 to 16 bare host names in small letters.