Rescript JS Map is a ReScript library that provides bindings to the JavaScript Map data type.
Installation
Using yarn or npm:
yarn add rescript-js-map npm install --save rescript-js-map
This package relies on the rescript-js-iterator package for Iterator bindings. In your bsconfig.json, add:
{
"bs-dependencies": ["rescript-js-map", "rescript-js-iterator"]
}Usage
module Map = Js_map let map = Map.make() let mutatedMap = map->Map.set("hello", "world") let isPhysicallyEqual = map === mutatedMap // true let hello = map->Map.get("hello") // Some("world") let hasHello = map->Map.has("hello") // true let foo = map->Map.get("bar") // None let size = map->Map.size // 1
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.