Readonly wrapper for Javascript Map
class
npm install readonly-map
const ReadonlyMap = require('readonly-map')
const map = new Map([['key1', 'value1'], ['key2', 'value2']])
const readonlyMap = ReadonlyMap(map)
console.log(readonlyMap.get('key1')) // 'value1'
readonlyMap.set('key3', 'value3') // throws TypeError
Creates a new readonly Map
object with the given Map
object as the target.
Returns the value associated with the given key, or undefined
if the key does
not exist in the map.
Returns true
if the map contains the given key, otherwise false
.
Returns an iterator over the keys in the map.
Returns an iterator over the values in the map.
Returns an iterator over the key-value pairs in the map.
This project is licensed under the MIT License - see the LICENSE file for details.