JSPM

@neumatter/slot-map

1.0.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q27444F

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

    Package Exports

    • @neumatter/slot-map
    • @neumatter/slot-map/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@neumatter/slot-map) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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')