Miss any of our Open RFC calls?Watch the recordings here! »

node-compound-counter

0.1.0 • Public • Published

Compound Counter

A Node.js module to use a single 32-bit positive integer as a record of integers. Loosely inspired by C structures.

Installation

npm install node-compound-counter --save

Basic Usage

 
// module deps
var
    CompoundCounter = require('node-compound-counter');
 
var
    counter = CompoundCounter.forge();
 
// field definition
counter
    .field('lo', 255)
    .field('hi', 31);
 
counter.lo.set(128);
counter.hi.set(16);
 
console.log(counter.get()); // 4224

Advanced Usage

 
// module deps
var
    CompoundCounter = require('node-compound-counter');
 
var
    counter = CompoundCounter.forge();
 
// field definition
counter
    .field('single', 255);
 
counter.single
    .on('error', function (error) {
        // your code here
    })
    .on('change', function (value) {
        // your code here
    });
 
counter
    .on('error', function (error) {
        // your code here
    })
    .on('change', function (value) {
        // your code here
    });

Install

npm i node-compound-counter

DownloadsWeekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • avatar