simpleglobals

Simple Globals implementation, inspired by Mumps Globals

npm install simpleglobals
8 downloads in the last month

SimpleGlobals

Simple Globals implementation, inspired by Mumps Globals.

Installation

Via npm on Node:

npm install simpleglobals

Usage

Reference in your program:

var simpleglobals = require('simpleglobals');

Create a database:

var db = simpleglobals.createDatabase();

Get a node:

var customer = db.node('customers', 1234);

Set and get a value:

db.node('customers', 1234, 'name').value('Adam');
var name = db.node('customers', 1234, 'name').value();

Alternatively, you can use a node:

var adam = db.node('customers', 1234);
adam.node('name').value('Adam');
var name = adam.node('name').value();

A node can be converted to a plain JavaScript object:

db.node('customers', 1234, 'name').value('Adam');
db.node('customers', 1234, 'age').value(800);

var obj = db.node('customers', 1234).toObject();
// obj is { name : 'Adam', age: 800 }

A node can be defined from a plain JavaScript object:

db.node('customers', 1235).fromObject( { name: 'Eve', age: 700 });

Development

git clone git://github.com/ajlopez/SimpleGlobals.git
cd SimpleGlobals
npm install
npm test

Samples

TBD

To do

  • Persistence
  • Samples

The current implementation is a naive one, all in-memory. It should be refactored to have a persistence store, using a database, file system, o NoSQL provider.

References

Inception

This module was inspired by the discussion Healthcare needs the help of the Node.js Community at Node.js mailing list, triggered by @rtweed.

Versions

  • 0.0.1: Published.

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.

npm loves you