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

c2p-commons

v1.1.1

Published

c2p-commons

Readme

c2p-commons

Overview

[c2p-commons] is a utility package that provides a collection of modules and utilities to facilitate various operations within your application. This package includes functionalities for event bus operations, Firestore interactions, date and time utilities, mathematical calculations, JSON Web Signature handling, custom error handling, and logging.

Installation

To install the c2p-commons package, use npm:

npm install c2p-commons

Usage

To use the modules and utilities provided by [c2p-commons], import them into your project as needed. Below are examples of how to import and use some of the key components.

Example

import { AzureEventBus, GoogleFirestore, DateTimeUtils, AntecipationContractCalc, CalculateOperation, CipJwsSignature, NotFoundError, Logger } from 'c2p-commons';

// Using AzureEventBus
const eventBus = new AzureEventBus();
eventBus.publish('eventName', { data: 'eventData' });

// Using GoogleFirestore
const firestore = new GoogleFirestore();
firestore.getDocument('collectionName', 'documentId');

// Using DateTimeUtils
const currentDate = DateTimeUtils.getCurrentDate();
console.log(currentDate);

// Using AntecipationContractCalc
const calcResult = AntecipationContractCalc.calculate({ amount: 1000, rate: 0.05 });
console.log(calcResult);

// Using CalculateOperation
const sum = CalculateOperation.add(5, 10);
console.log(sum);


// Using Logger
Logger.info('This is an info message');
Logger.error('This is an error message');

Modules and Utilities

AzureEventBus

  • Path: ./bus/azure
  • Description: Handles event bus operations for Azure.

GoogleFirestore

  • Path: ./firestore/googleFirestore
  • Description: Manages interactions with Google Firestore.

DateTimeUtils

  • Path: ./utils/DateTimeUtils
  • Description: Provides utility functions for date and time operations.

AntecipationContractCalc

  • Path: ./math/AntecipationContractCalc
  • Description: Performs calculations related to anticipation contracts.

CalculateOperation

  • Path: ./math/CalculateOperation
  • Description: General mathematical operations and calculations.

CipJwsSignature

  • Path: ./utils/CipJwsSignature
  • Description: Handles JWS (JSON Web Signature) operations.

NotFoundError

  • Path: ./exceptions/NotFoundError
  • Description: Custom error class for handling "Not Found" errors.

Logger

  • Path: ./logger
  • Description: Logging utility for the application.

Contributing

Contributions are welcome! Please open an issue or submit a pull request with your changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any questions or inquiries, please contact the project maintainers.

Usage

require('dotenv').config();

import {
  BufferEnvPresenter,
  EnvBootstrap,
  Environment,
  NumberEnvPresenter,
  TextEnvPresenter,
} from '@heronlabs/presenter-env';

import {Module, Inject} from '@nestjs/common';

export class Configuration {
  public server = {
    port: this.numberEnvPresenter.getValueByKey('API_PORT'),
  };

  public jwt = {
    publicKey: this.bufferEnvPresenter.getValueByKey('JWT_PUBLIC_KEY_PATH'),
    algorithm: this.textEnvPresenter.getValueByKey('JWT_ALGORITHM'),
  };

  constructor(
    @Inject(NumberEnvPresenter) private numberEnvPresenter: Environment<number>,
    @Inject(BufferEnvPresenter) private bufferEnvPresenter: Environment<Buffer>,
    @Inject(TextEnvPresenter) private textEnvPresenter: Environment<string>
  ) {}
}

@Module({
  providers: [Configuration],
  imports: [EnvBootstrap],
})
export class ApiBootstrap {}