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

@everllence/ngx-chain-functional-guards

v19.1.0

Published

An Angular guard that executes functional guards in a serial manner, waiting for each one to complete before proceeding to the next.

Downloads

823

Readme

License npm version Semantic Release

Ngx Chain Functional Guards

Ngx Chain Functional Guards is a small library that provides functions to control the execution flow of Angular route guards. It includes chainActivationGuards and chainDeactivationGuards for serial execution, and parallelizeActivationGuards for parallel execution of independent guards.

Installation

Requires the following peer dependencies:

  • @angular/core (>= 19.0.0)
  • @angular/router (>= 19.0.0)
  • rxjs (>= 7.0.0)

Example

canActivate, canActivateChild

import { chainActivationGuards } from 'ngx-chain-functional-guards';

// In the route config:
{
  path: '...',
  // chain the desired guards
  canActivate: [chainActivationGuards(SomeGuard1, SomeGuard2, ...)],
  ...
}

canDeactivate

import { chainDeactivationGuards } from 'ngx-chain-guards';

// In the route config:
{
  path: '...',
  // chain the desired guards
  canDeactivate: [chainDeactivationGuards(SomeGuard1, SomeGuard2, ...)],
}

Combining Serial and Parallel Guards

For performance optimization, you can mix serial and parallel guard execution. This is useful when some guards depend on each other while others are independent:

import { chainActivationGuards, parallelizeActivationGuards } from 'ngx-chain-functional-guards';

// In the route config:
{
  path: '...',
  canActivate: [
    chainActivationGuards(
      guard1,                                    // Runs first
      guard2,                                    // Runs after guard1 (depends on guard1)
      parallelizeActivationGuards(guard3, guard4), // guard3 and guard4 run in parallel
      guard5                                     // Runs after guard3 and guard4 complete
    )
  ],
  ...
}

In this example:

  • guard1 executes first
  • guard2 waits for guard1 to complete (sequential dependency)
  • guard3 and guard4 run in parallel (independent guards)
  • guard5 waits for both guard3 and guard4 to complete

API

chainActivationGuards

The chainActivationGuards function executes guards in a serial manner, waiting for each one to complete before proceeding to the next.

export declare function chainActivationGuards(...guards: CanActivateFn[]): CanActivateFn
export declare function chainActivationGuards(...guards: CanActivateChildFn[]): CanActivateChildFn

chainDeactivationGuards

The chainDeactivationGuards function executes deactivation guards in a serial manner.

export declare function chainDeactivationGuards(
  ...guards: CanDeactivateFn<never>[]
): CanDeactivateFn<never>

parallelizeActivationGuards

The parallelizeActivationGuards function runs all given guards in parallel without waiting for each other. It completes immediately if any guard returns a non-true result, or waits for all guards to complete if they all return true. This is useful for performance optimization when guards are independent and don't have dependencies on each other.

export declare function parallelizeActivationGuards(...guards: CanActivateFn[]): CanActivateFn

Use case: Combine with chainActivationGuards to optimize guard execution when you have a mix of dependent and independent guards.

Utilities

wrapIntoObservable

A lightweight utility function that normalizes any value—whether it's a plain value, a Promise, or an Observable—into an Observable. This is especially useful in Angular or RxJS-heavy applications where consistent reactive patterns are desired.

export declare function wrapIntoObservable<T>(value: T | Promise<T> | Observable<T>): Observable<T> {