type

Dict

@Js
const mixin Dict

Dict is an immutable map of name/value pairs.

methods

dis

Get display string for the dict.

each

Iterate through the name/value pairs

eachWhile

Iterate through the name/value pairs until the given function returns non-null, then break the iteration and return resulting object.

get

Get the value for the given name or null if name not mapped

has

Return true if this dictionary contains given name

id

Get the id tag as a Ref or raise CastErr/UnknownNameErr

isEmpty

Return if the there are no name/value pairs

missing

Return true if this dictionary does not contain given name

toStr

Return string for debugging only

trap

Get the value mapped by the given name.

Slot Details

dis

virtual Str dis()

Get display string for the dict. The default routes to Etc.dictToDis or fallback on toStr.

each

abstract Void each(|Obj,Str| f)

Iterate through the name/value pairs

eachWhile

abstract Obj? eachWhile(|Obj,Str->Obj?| f)

Iterate through the name/value pairs until the given function returns non-null, then break the iteration and return resulting object. Return null if function returns null for every name/value pair.

get

@Operator
abstract Obj? get(Str name)

Get the value for the given name or null if name not mapped

has

abstract Bool has(Str name)

Return true if this dictionary contains given name

id

virtual Ref id()

Get the id tag as a Ref or raise CastErr/UnknownNameErr

isEmpty

abstract Bool isEmpty()

Return if the there are no name/value pairs

missing

abstract Bool missing(Str name)

Return true if this dictionary does not contain given name

toStr

virtual override Str toStr()

Return string for debugging only

trap

abstract override Obj? trap(Str name, Obj?[]? args := null)

Get the value mapped by the given name. If it is not mapped to a non-null value, then throw an UnknownNameErr.