as

Convenience function that attempts to extract a property value from a property list (an associative array of strings indexed by strings) and convert it to a specified type.

  1. T as(string[string] properties, string name, T alternative = T.init)
    T
    as
    (
    T
    )
    (
    string[string] properties
    ,
    string name
    ,
    T alternative = T.init
    )
  2. bool as(string[string] properties, string name, T alternative = T.init)

Parameters

properties
Type: string[string]

The associative array to locate the property in.

name
Type: string

The name the value is currently keyed under.

alternative
Type: T

The value to return in the case that the properties list doesn't contain the named property. Defaults to whatever the default initialization value for the desired type is.

Meta