Metadatable

Mixin for objects which have a metadata property

Methods

getMeta(key) → {*}

Get metadata by dot notation Warning: This method is very permissive and will not error on a non-existent key. Rather, it will return false.

Parameters:
Name Type Description
key string

Key to fetch. Supports dot notation e.g., "foo.bar"

Throws:

Error

Returns:
*

setMeta(key, value)

Set a metadata value. Warning: Does not autovivify, you will need to create the parent objects if they don't exist

Parameters:
Name Type Description
key string

Key to set. Supports dot notation e.g., "foo.bar"

value *

Value must be JSON.stringify-able

Fires:
Throws:
  • Error

  • RangeError