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

@dark-light-20/invest-domain

v1.0.2

Published

This package contains the core domain logic for the investments project, including entities, value objects, and business rules.

Readme

@dark-light-20/invest-domain

This package contains the core domain logic for the investments project, designed to be framework-agnostic and reusable across backend services and frontend applications. It enforces Clean Architecture principles by isolating business rules from infrastructure details.

🚀 Features

  • Domain Entities & Value Objects: Type-safe definitions for financial products like CDTs, FICs, and Savings Pockets.
  • Use Cases: Pure business logic implementations for simulations and rate calculations.
  • Abstract Gateways: Interfaces defining contracts for data retrieval, enabling Dependency Inversion.
  • Hybrid Build: Bundled with tsup to support both ESM and CommonJS, ensuring compatibility with modern Angular apps and Node.js backends.
  • Tested: Comprehensive unit test suite using Jest.

📦 Installation

npm install @dark-light-20/invest-domain

🏗 Architecture

Domain Layer (Value Objects)

Defines the core data structures and types:

  • CdtRate, CdtSimulation
  • FicRate
  • PocketSimulation

Application Layer (Use Cases)

Contains the business logic services:

  • CDT: CdtUseCase (Simulate returns based on amount and term).
  • FIC: FicUseCase (Retrieve historical rates).
  • Pocket: PocketUseCase (Simulate savings growth with monthly contributions).

Ports (Gateways)

Abstract interfaces that must be implemented by the infrastructure layer (Dependency Inversion):

  • CdtGateway
  • FicGateway
  • PocketGateway

🛠 Usage

Implementing a Gateway

import { CdtGateway, CdtRate } from "@dark-light-20/invest-domain";

export class MyCdtRepository implements CdtGateway {
  async getAllCDTRates(): Promise<CdtRate[]> {
    // Fetch data from API or Database
    return [];
  }
}

Using a Use Case

import { CdtUseCase, CDTTermUnit } from "@dark-light-20/invest-domain";

const useCase = new CdtUseCase(new MyCdtRepository());
const simulation = await useCase.simulateCDT(1000000, 360, CDTTermUnit.DAYS);

🧪 Testing

This library uses Jest for unit testing to ensure the reliability of business rules.

npm run test

⚡ Build

The project uses tsup for efficient bundling, ensuring zero-config TypeScript compilation:

npm run build

This generates optimized output for both esm (ECMAScript Modules) and cjs (CommonJS) formats in the dist directory.

License

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