Detalhes do pacote

@neumatter/slot-map

clyng5751.0.2

Create private fields using a SlotMap. Similar to internal slots.

slots, internal slots, slot map, nodejs

readme (leia-me)

SlotMap

JavaScript Style Guide

Create private fields using a SlotMap. Similar to internal slots.


Table of Contents


Install

npm i slot-map


Usage

static SlotMap.get:

Gets or creates the SlotMap for the given object.

import SlotMap from 'slot-map'

const obj = {}
const slotMap = SlotMap.get(obj)

static SlotMap.set:

Sets the SlotMap for the given object.

import SlotMap from 'slot-map'

const obj = {}
SlotMap.set(obj, slotMap)

static SlotMap.setInternal:

Sets a property in the SlotMap for the given object.

import SlotMap from 'slot-map'

const obj = {}
SlotMap.setInternal(obj, 'id', '01234')

static SlotMap.getInternal:

Gets a property in the SlotMap for the given object.

import SlotMap from 'slot-map'

const obj = {}
SlotMap.getInternal(obj, 'id')