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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ddd-framework/collections

v1.1.4

Published

> `@ddd-framework/collections` is a package within the comprehensive `@ddd-framework` framework. It provides classes for managing collections in a Domain-Driven Design (DDD) context specifically for Node.js.

Downloads

5

Readme

@ddd-framework/collections

@ddd-framework/collections is a package within the comprehensive @ddd-framework framework. It provides classes for managing collections in a Domain-Driven Design (DDD) context specifically for Node.js.

Description

The @ddd-framework/collections package extends the functionality of the @ddd-framework by offering additional classes related to collections. These utilities facilitate the management and manipulation of collections in a DDD-oriented manner within Node.js applications.

Documentation

For more detailed information on @ddd-framework/collections, including usage examples and API reference, please refer to the official documentation.

Installation

To install @ddd-framework/collections, ensure you have the following prerequisites:

  • Node.js stable version
  • pnpm

Once the prerequisites are installed, run the following command:

$ pnpm i @ddd-framework/collections
...

This will install the @ddd-framework/collections package and its dependencies.

Features

The @ddd-framework/collections package provides the following features:

  • EntityCollection: The EntityCollection class represents a collection of entities in the domain model. It provides convenient methods for managing and accessing entities within the collection.
  • List: The List class is an immutable ordered collection that allows storing and manipulating elements. It provides various operations such as adding, removing, retrieving elements from the list, and more.

By utilizing these features from the @ddd-framework/collections package, developers can effectively manage collections of entities and lists within their Node.js applications following DDD principles.

Usage

To use @ddd-framework/core, import the desired classes, interfaces, or functions from the package. For example:

import {
  Entity,
  EntityCollection,
  EntityId,
  Identity,
  IllegalStateException
} from '@ddd-framework/core';

class UserId extends Identity {
  protected validate(): void {
    if (!this.value) throw new IllegalStateException('id is required');
  }
}

class User extends Entity {
  @EntityId()
  public id: UserId;

  constructor(id: UserId) {
    super();
    this.id = id;
  }
}

const user = new User(new UserId(faker.string.uuid()));

const collection = new EntityCollection<User>();

expect(collection.add(user).contains(user)).toBeTruthy();

License

@ddd-framework/collections is released under the MIT License. Feel free to customize it further to fit your needs.