npm.io
1.0.0 • Published 8 years ago

strict-map

Licence
MIT
Version
1.0.0
Deps
0
Size
2 kB
Vulns
0
Weekly
0
Stars
9

strict-map

Stricter Map

Installation

yarn add strict-map

Usage

const StrictMap = require('strict-map');

let map = new StrictMap();

map.set('foo', 1);
map.set('bar', 2);

map.get('foo');
map.get('bar'); // Error!

This is especially useful with Flow or TypeScript where you'd normally have to check if the value returned from map.get() is undefined.