npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cal-vals

v1.0.11

Published

`cal-vals` is an npm package designed to manage **changing values** over time. It provides a robust and traceable way to handle values whose changes are fully auditable and can be recalculated for any given point in time. This library is particularly usef

Downloads

28

Readme

cal-vals

cal-vals is an npm package designed to manage changing values over time. It provides a robust and traceable way to handle values whose changes are fully auditable and can be recalculated for any given point in time. This library is particularly useful for scenarios where historical data tracking and value regeneration are critical.

The library supports two types of values:

  • Additive Values: Numeric values where changes are tracked as additions or subtractions. Each operation is logged, and the cumulative value can be recalculated at any point in time.
  • Fixed Values: String values where changes replace the previous value. The full history of changes is preserved, and the value at a specific point in time can be restored.

Features

  • Time-based Value Management: Track how values change over time.
  • Traceability: Fully trace and audit all changes to a value.
  • Regeneration: Recalculate the value of a variable at any specific point in time.
  • Model-Driven Design: Built around a flexible and extensible model structure.
  • CalVal Class: Centralized functionality for managing and auditing value changes.

Installation

npm install cal-vals

Usage

Importing the Library

const { CalVal, Model } = require('cal-vals');

Defining a Model

The Model class allows you to define the structure of your data.

const myModel = new Model({
    name: 'exampleModel',
    fields: ['field1', 'field2', 'field3']
});

Using the CalVal Class

The CalVal class provides all the functionality for managing and auditing value changes.

const calVal = new CalVal(myModel);

// Add a value with a timestamp
calVal.addValue('field1', 100, new Date('2023-01-01'));

// Update the value at a later time
calVal.addValue('field1', 150, new Date('2023-02-01'));

// Retrieve the value at a specific point in time
const valueAtTime = calVal.getValue('field1', new Date('2023-01-15'));
console.log(valueAtTime); // Output: 100

// Audit all changes to a field
const auditLog = calVal.getAuditLog('field1');
console.log(auditLog);

API Reference

Model

  • Constructor: new Model(config)
    • config: An object defining the model's name and fields.
  • Methods:
    • getFields(): Returns the list of fields in the model.

CalVal

  • Constructor: new CalVal(model)
    • model: An instance of the Model class.
  • Methods:
    • addValue(field, value, timestamp): Adds or updates a value for a specific field at a given timestamp.
    • getValue(field, timestamp): Retrieves the value of a field at a specific timestamp.
    • getAuditLog(field): Returns the audit log of all changes for a specific field.

Use Cases

  • Financial Applications: Track and audit changes in financial data over time.
  • Versioned Data: Manage historical versions of data in a traceable way.
  • Auditing Systems: Ensure full traceability and accountability for value changes.

Contributing

Contributions are welcome! Please submit a pull request or open an issue on the GitHub repository.

License

This project is licensed under the TBD.

Acknowledgments

Special thanks to all contributors and users who have supported the development of this library.