SimpleContext
Associate arbitrary data with a context (a simple plain JavaScript object).
Installation
Via npm on Node:
npm install simplecontext
Usage
Reference in your program:
var sc = ;
Create an space to store the data and contexts:
var space = sc;
Add an item to a context:
space;space;space;
A context is a simple JavaScript object, like { country: 'UK' }
or { country: 'UK', category: 'Dairy' }
.
Internally, { country: 'UK', category: 'Dairy' }
and { category: 'Dairy', country: 'UK' }
are the
same context.
Retrieve the items associated to a context:
var result = space; // [ 'John', 'Mary' ]var result = space; // [ ]var result = space; // [ 'John', 'Mary', 'Ann' ]
Notice the use of inheritance in the last retrieve.
Retract an item from a context:
space;
Remove a context:
space;
Development
git clone git://github.com/ajlopez/SimpleContext.git
cd SimpleContext
npm install
npm test
Samples
TBD
References
TBD
Contribution
Feel free to file issues and submit pull requests � contributions are welcome<
If you submit a pull request, please be sure to add or update corresponding
test cases, and ensure that npm test
continues to pass.