dbx-value-pipes

Provides Angular template pipes for formatting, truncation, and observable conversion.

13|Updated Jan 7, 2022
One-click install
npx skills add https://github.com/dereekb/dbx-components --skill dbx-value-pipes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dbx-value-pipes
Source: https://github.com/dereekb/dbx-components/tree/main/.agent/skills/dereekb-dbx-value-pipes
Command: npx skills add https://github.com/dereekb/dbx-components --skill dbx-value-pipes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Angular templates frequently require transforming values for display, such as truncating text, formatting numbers or dates, and resolving GetterOrValue types. The dbx-value-pipes library provides a cohesive set of pipes that centralize these concerns, reducing boilerplate and ensuring consistent presentation across components.

Core Features & Use Cases

  • Resolve GetterOrValue<T> types with GetValuePipe and GetValueOncePipe.
  • Truncate long text with CutTextPipe.
  • Format currency with DollarAmountPipe.
  • Date/time formatting and range pipes (dateDayRange, dateTimeRange, etc.).
  • Convert values to observables for async pipelines with AsObservablePipe.
  • Pretty-print JSON with PrettyJsonPipe and simple template-wide formatting.
  • Easily compose pipes in templates for rich UI presentations.

Quick Start

Install the library and import the needed pipes into your Angular app. Then, use in templates like {{ value | getValue }} or {{ price | dollarAmount }}. For standalone components, import the pipes directly in the component metadata.

Frequently Asked Questions about dbx-value-pipes

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I truncate text and format dates directly within Angular templates?

You can transform values directly in Angular templates using dedicated pipes for common UI formatting tasks like text truncation and date formatting. This library provides a cohesive suite of these pipes to centralize presentation logic and reduce boilerplate.

What is the best way to resolve GetterOrValue types for display in Angular?

The best way to resolve GetterOrValue types for display is using the GetValuePipe or GetValueOncePipe. These pipes handle the resolution directly within the template, eliminating the need for manual unwrapping logic inside your component TypeScript files.

Do I need to install any specific libraries to use these Angular value transformation pipes?

Yes, you need to install the @dereekb/dbx-core library in your Angular project to use these value transformation pipes. After installation, import the needed pipes into your app or directly into your standalone component metadata.

How do I convert a static value to an observable for an async pipeline in Angular templates?

You can convert a static value to an observable for async pipelines in Angular templates using the AsObservablePipe. This allows the value to flow seamlessly into async pipe chains directly within the template markup.

Can I format currency amounts and pretty-print JSON in Angular without writing custom component logic?

Yes, you can format currency amounts with the DollarAmountPipe and pretty-print JSON with the PrettyJsonPipe directly in templates. These pipes handle the formatting presentation without requiring custom component logic.

Does this Angular pipes solution support standalone components?

Yes, this Angular pipes solution supports standalone components. You can import the individual pipes directly into your standalone component metadata to use them within your template markup.