KScript docs
EN

domain fields and methods

A field is a plain fact about the value, read with a dot and no brackets: $value.name. A method takes arguments or does work, and is called with ->: $value->name(arguments), or with the value piped in: $value |> name(arguments).

Fields

FieldTypeDescription
.labelslistIts parts: ['api', 'example', 'com'].
.tldstringThe last part: com, or uk for example.co.uk.

From KScript.Core

#domain->ascii() → string

The form DNS uses, with international labels as xn--: xn--bcher-kva.example for bücher.example.
Example
<let name="x" type="domain" value="'Bücher.example'" />
<echo>{ $x } { $x->ascii() }</echo>
$x: domain = 'Bücher.example'
echo "{ $x } { $x->ascii() }"

#domain->is_subdomain_of(other: string) → bool

True when it is the other domain or under it: api.example.com is under example.com.
ParameterTakes
other requiredstring
Example
<let name="x" type="domain" value="'api.example.co.uk'" />
<echo>{ $x->is_subdomain_of('example.co.uk') }</echo>
$x: domain = 'api.example.co.uk'
echo $x->is_subdomain_of('example.co.uk')

Methods from any

Methods from string