@gmjs/data-container-util
v0.0.1
Published
Some utilities for data containers.
Readme
Data Container Utilities
Some utilities for data containers such as Map and Set.
Installation
npm install --save @gmjsdata-container-utilAPI
Map
mapGetOrThrow
Gets the value from a Map or throws an error if the key is not present.
const map = new Map<string, string>([['foo', 'bar']]);
const value: string = mapGetOrThrow(map, 'foo');
console.log(value);
// 'bar'const map = new Map<string, string>([['foo', 'bar']]);
// the following line throws an error
const value: string = mapGetOrThrow(map, 'baz');