rx-map

An Rx based map

Usage no npm install needed!

<script type="module">
  import rxMap from 'https://cdn.skypack.dev/rx-map';
</script>

README

Rx Map

An Rx based map implementation

Example

var Rx    = require("rx");
var RxMap = require("rx-map");

var map = new RxMap();

map.subscribe(function(data) {
    console.log("map updated: " + data.key + " => " + data.value);
});

map.set("morning", "coffee");
map.set("afternoon", "espresso");
map.set("night", "tea");

map.get("morning").subscribe(console.log);

map.getOrElse("yesterday", function() {
    return Rx.Observable.returnValue("nothing");
}).subscribe(console.log);

map.putIfAbsent("yesterday", function() {
    return Rx.Observable.returnValue("beer");
}).subscribe(console.log);