Swapy
v1.0.3
  1. Methods
  2. Get SlotItemMap

Each Swapy instance keeps track of the current relationship between slots and items. You can query that using swapy.slotItemMap() method.

const currentSlotItemMap = swapy.slotItemMap()

console.log(currentSlotItemMap.asObject)
// {
//   'foo': 'a',
//   'bar': 'b',
//   'baz': 'c'
// }

console.log(currentSlotItemMap.asArray)
// [
//   { slot: 'foo', item: 'a' },
//   { slot: 'bar', item: 'b' },
//   { slot: 'baz', item: 'c' }
// ]

console.log(currentSlotItemMap.asMap)
// Map(3) {
// 'foo' => 'a',
// 'bar' => 'b',
// 'baz' => 'c'
// }