TypeCode specifying the type of all keys
TypeCode specifying the type of all values
Either a Record<string, V> (for string keys) or Map<K, V>
RelishMap value
import { Map_, String_, U32, encode } from '@grounds/core';
// Map with string keys and 32-bit integer values
const scores = Map_(
0x0e, // TypeCode.String
0x04, // TypeCode.U32
{ alice: 100, bob: 95 }
);
encode(scores).match(
(bytes) => console.log('Map encoded:', bytes),
(error) => console.error(error)
);
Creates a homogeneous map Relish value.
The name has an underscore suffix to avoid shadowing the global Map object. All keys and values must match their respective types. For string keys, accepts either Record<string, V> or Map for convenience. For non-string keys, requires a native JavaScript Map.