Skip to content

doctore/AngularUtil

Repository files navigation

AngularUtil

Why was this project created?

The main goal is to include several general purpose functionality, mainly related to functional programming, in a common Angular project.

Elements included in this project

Below is shown a brief introduction to the functionality included in this one:

New types

New types providing generic functionality like:

  • Comparator comparison function, which imposes a total ordering on some collection of objects.
  • Consumer represents an operation that accepts zero or more input arguments and returns no result.
  • Generic subject wrapper of RxJS Subject adding several customizations.

Others related with functional programming:

  • Either represents a value of one of two possible types (a disjoint union).
  • Function represents an operation that accepts zero or more input arguments and returns a result.
  • Predicate represents an operation that accepts zero or more input arguments and returns a boolean result based on provided data.
  • Optional a container object which may or may not contain a non-null value.
  • Try computation representation that may either result in an error, or return a successfully computed value.
  • Validation used to validate the given instance, defining 2 different status to manage the result: Valid and Invalid.

Collections

There are new collections used to store, search, sort and organize data more easily - all using standardized methods and patterns:

  • Set stores a collection of unique elements.
    • MutableHashSet: unordered collection of unique elements based on hash function to locate internal elements. This Set can be updated, reduced or extended in place.
    • MutableLinkedHashSet: collection of unique elements based on hash function to locate internal elements that maintains insertion order. This Set can be updated, reduced or extended in place.
    • ImmutableHashSet: unordered collection of unique elements based on hash function to locate internal elements. This Set never change, that is, all the operations updating it will return a new Set and leave the old one unchanged.
    • ImmutableLinkedHashSet: collection of unique elements based on hash function to locate internal elements that maintains insertion order. This Set never change, that is, all the operations updating it will return a new Set and leave the old one unchanged.

Services

Util classes

How to use the project

This project was generated using Angular CLI version 21.0.3.

Development server

To start a local development server, run:

ng serve

Once the server is running, open your browser and navigate to http://localhost:4200/. The application will automatically reload whenever you modify any of the source files.

Code scaffolding

Angular CLI includes powerful code scaffolding tools. To generate a new component, run:

ng generate component component-name

For a complete list of available schematics (such as components, directives, or pipes), run:

ng generate --help

Building

To build the project run:

ng build

This will compile your project and store the build artifacts in the dist/ directory. By default, the production build optimizes your application for performance and speed.

Running unit tests

To execute unit tests with the Vitest test runner, use the following command:

ng test

Running benchmarks

To execute benchmarks with the Vitest benchmark runner, use the following command:

vitest bench

Running end-to-end tests

For end-to-end (e2e) testing, run:

ng e2e

Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.

Additional Resources

For more information on using the Angular CLI, including detailed command references, visit the Angular CLI Overview and Command Reference page.

Changelog

There are previous versions of this project located with other git branches different than main:

  • 2.7.5 related with Angular 15 and TypeScript 4.9.

About

Common functionality for Angular projects, mainly related to functional programming

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages