JSPM

node-compound-counter

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q26282F
  • License MIT

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

Package Exports

  • node-compound-counter

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-compound-counter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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
    });