0.0.3 • Published 9 months ago

constrained-map v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

constrained-map

Install

npm install constrained-map

Usage

import { ConstrainedMap } from 'constrained-map'

class Request { /* ... */ }
const map = new ConstrainedMap<[[Request, number], [string, string]]>

const requestKey = new Request()
map.set(requestKey, 1)

const requestValue = map.get(requestKey) // type constrained to number


const strKey = 'key'
map.set(strKey, 'value')

const strValue = map.get(strKey) // type constrained to string

Credits

  • Me, myself and I
0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago