-
Notifications
You must be signed in to change notification settings - Fork 0
inverse
Subhajit Sahu edited this page Feb 10, 2020
·
3 revisions
Gives reversed bi-directional map.
BiMap.prototype.inverse;
// --> reversed bi-directional map
const BiMap = require('extra-bimap');
var m = new BiMap();
// BiMap [Map] {}
m.set(1, 'a');
// BiMap [Map] { 1 => 'a' }
m.set(2, 'b');
// BiMap [Map] { 1 => 'a', 2 => 'b' }
m.inverse;
// BiMap [Map] { 'a' => 1, 'b' => 2 }
m.inverse.set('b', 3);
// BiMap [Map] { 'a' => 1, 'b' => 3 }
m.inverse.inverse
// BiMap [Map] { 1 => 'a', 3 => 'b' }