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

optimus-pipes

v1.0.0

Published

`ngx-optimus` is an Angular library dedicated to providing a collection of useful custom pipes to transform data in your templates. This library aims to simplify common data formatting tasks and keep your component logic cleaner.

Readme

NgxOptimus

ngx-optimus is an Angular library dedicated to providing a collection of useful custom pipes to transform data in your templates. This library aims to simplify common data formatting tasks and keep your component logic cleaner.

Demo

You can see the pipes in action here: OptimusPipes Demo

Purpose

The main goal of ngx-optimus is to offer a set of reusable and well-tested pipes that can be easily integrated into any Angular project, helping developers to format data directly in their HTML templates with ease.

Installation

To get started with ngx-optimus, install it from npm:

npm install ngx-optimus

Usage

You can use optimus-pipes pipes in both standalone components and components that are part of an NgModule.

1. For Standalone Components: If you are using standalone components, you can import the specific pipes you need directly into your component's imports array. Assuming SentenceCasePipe is the pipe for the transformation and is exported from optimus-pipes: sentenceCase Alternatively, you can import NgxOptimusPipesModule which is a bundle of all pipes provided by optimus pipes.

// src/app/your-standalone-component/your-standalone-component.component.ts
import { Component } from '@angular/core';
import { SentenceCasePipe } from 'optimus-pipes'; // Ensure this path and pipe name are correct

@Component({
selector: 'app-your-standalone-component',
standalone: true,
imports: [
SentenceCasePipe // Add the individual pipe here
// Other imports like CommonModule if needed
],
template: `
    <!-- Assuming 'myString' is a property in your component -->
    <!-- e.g., myString = "helloWorldExample"; or myString = "hello_world_example"; -->
    <p>{{ myString | sentenceCase }}</p>
    <!-- Output: Hello world example -->
  `
})
export class YourStandaloneComponent {
myString: string = "helloWorldExample";
}

// src/app/your-standalone-component/your-standalone-component.component.ts
import { Component } from '@angular/core';
**import { NgxOptimusPipesModule } from 'optimus-pipes'; // Ensure this path

@Component({
selector: 'app-your-standalone-component',
standalone: true,
imports: [
NgxOptimusPipesModule // Add the pipes module here
// Other imports like CommonModule if needed
],
template: `
    <!-- Assuming 'myString' is a property in your component -->
    <!-- e.g., myString = "helloWorldExample"; or myString = "hello_world_example"; -->
    <p>{{ myString | sentenceCase }}</p>
    <!-- Output: Hello world example -->
  `
})
export class YourStandaloneComponent {
myString: string = "helloWorldExample";
}**

2. For Components within NgModules: If your component is part of an Angular module (e.g., AppModule or a feature module), you can import any pipe in the module. (Assuming the module name follows the convention [LibraryName]Module). You could also import the NgxOptimusPipesModule inside the AppModule or a feature module to get access to all pipes.

// src/app/app.module.ts (or your feature module)
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { SentenceCasePipe } from 'optimus-pipes'; // Import pipe from optimus-pipes

import { AppComponent } from './app.component';

@NgModule({
declarations: [
AppComponent
// Your other components declared in this module
],
imports: [
BrowserModule,
SentenceCasePipe // Add Any pipe here
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

Using the pipes in your templates: Once imported (either individually for standalone components or via the module for NgModules-based components), you can use the pipes in your component templates. For example, to use the pipe: sentenceCase

<!-- Assuming 'myString' is a property in your component -->
<!-- e.g., myString = "helloWorldExample"; or myString = "hello_world_example"; -->
<p>{{ myString | sentenceCase }}</p>
<!-- Output: Hello world example -->

Available Pipes

Here's a list of the pipes currently available in optimus-pipes:

| Pipe | Description | Usage Example | |----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------| | sentenceCase | Converts a string into sentence case. Handles camelCase, PascalCase, snake_case, and kebab-case inputs. | {{ 'hello_world' \| sentenceCase }} | | truncate | Shortens a string to a specified length and appends an ellipsis if truncated. Accepts a character limit (default: 30) and an optional ellipsis string (default: '...'). | {{ 'This is a very long string' \| truncate:20:'...' }} | | timeAgo | Converts a date or timestamp into a human-readable relative time format (e.g., 'a few seconds ago', '5 minutes ago', '2 weeks ago', '1 year ago'). Handles various input formats including Date objects, timestamps, and date strings. | {{ '2023-10-01T12:00:00Z' \| timeAgo }} | | codeCase | Converts a string into different code case formats: camelCase, PascalCase, snake_case, or slug. | {{ 'hello world' \| codeCase }} | | initials | Generates initials from a given string, useful for creating avatar initials. Accepts a string and returns the first letters of each word. | {{ 'John Doe' \| initials }} | | stripHtml | Removes HTML tags from a string, ensuring it's rendered as plain text. | {{ '<p>Hello <b>World</b></p>' \| stripHtml }} | | default | Provides a default value when input is empty (null, undefined, empty string). Can be configured to also treat empty arrays, empty objects, and zero as empty. Supports static defaults or function-based dynamic defaults. | {{ user.profileImageUrl \| default:'/assets/default-avatar.png' }} | | filterBy | Filters an array of objects based on a property value and a search term. Useful for client-side filtering of lists. | {{ users \| filterBy:'name':'John' }} |