0.0.10 • Published 9 years ago

vennmap v0.0.10

Weekly downloads
1
License
ISC
Repository
-
Last release
9 years ago

VennMap

VennMap is a small javascript library that allows the construction of a collection objects that can then be accessed by any member property of the objects added.

Indexes are generated on the first request to get a list of objects by key or keys. Those indexes are then maintained for the lifetime of the VennMap object.

The member properties on any object added are replaced by a getter/setter, allowing VennMap to move objects from one branch of an index to another.

VennMap will not perform as well where the number of get requests is low compared to the number of inserts, or on very small sets of data compared with simply enumerating all objects your self. It does however provide a very convenient way of storing and retrieving objects.

var VennMap=require("vennmap");
var vm=new VennMap();
//
vm.add({"group":"Vehicles","type":"Car","maker":"Volvo", "details": {"year":1999}});
vm.add({"group":"Vehicles","type":"Car","maker":"Ford", "details": {"year":1997}});
vm.add({"group":"Vehicles", "type":"Van","maker":"Vauxhall","details": {"year":1999}});
vm.get({"details":{"year":1999}}) // returns the Volvo and Vauxhall above
vm.get({"group":"Vehicles"}) // returns all 3 items above
var newCar={"group":"Vehicles","type":"Car","maker":"Bentley", "details": {"year":2010}};
vm.add(newCar);
//to remove it
vm.remove(newCar);

Note that VennMap adds a function closure to your object in order to track it. This function closure will not been seen when you serialize to JSON.

0.0.10

9 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago