setExtra(key, extra)

Sets (replaces existing) extra.

Arguments

  1. key (string): Key to store the extra under (represents given item).

  2. extra (object): Extra data to replace existing one.

Returns

(object): The extra part of Item - here, the very same that was passed to be set.

(undefined): If item is not found (thus no extra can be added), returns undefined.

Example

// `extra` will be either an object or undefined - depending if item exists or not
const extra = adapter.setExtra('key', { some: 'data' });

Last updated