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

extra-pipe

v1.0.5

Published

This library provides a collection of custom pipes that you can use to enhance your Angular applications. Each pipe serves a specific purpose, from text formatting to data manipulation. The pipes are designed to be standalone, making it easy to integrate

Downloads

10

Readme

Extra Pipe 🚀

Welcome to the documentation for the extra-pipe library! This library provides a collection of custom pipes that you can use to enhance your Angular applications. Each pipe serves a specific purpose, from text formatting to data manipulation. The pipes are designed to be standalone, making it easy to integrate them into your projects.

Table of Contents

  1. Installation
  2. Usage
  3. Pipes
    • CapitalizePipe
    • FileSizePipe
    • HidePipe
    • Base64ImgUrlPipe
    • LocalizedPipe
    • RoundHalfUpPipe
    • UpperCaseFromPipe
    • ReplaceCommaPipe
    • NumberToWordsPipe
    • RemoveByKeyPipe
    • CamelCaseToTitleSeparatedCasePipe
    • FormatInstanceofDatePipe
    • IncludesPipe
    • RemoveDuplicatesByKeyPipe
    • UnderscoreToTitlePipe
    • CamelToSnakePipe
    • SnakeToCamelPipe
  4. Contribution
  5. License

Installation

To start using the extra-pipe library, you need to install it in your Angular project. You can do this using npm or yarn:

npm install extra-pipe

or

yarn add extra-pipe

Usage

Once you've installed the library, you can import and use the custom pipes in your Angular components and templates. Import the desired pipe and add it to your NgModule's declarations array.

import { NgModule } from '@angular/core';
import { CapitalizePipe } from 'extra-pipe';

@NgModule({
  declarations: [
    // ... other declarations
    CapitalizePipe,
  ],
})
export class YourModule {}

Now you can use the CapitalizePipe in your component templates:

{{'title' | capitalize }}

Pipes

CapitalizePipe

This pipe capitalizes the first letter of a string.

<p>{{ 'hello' | capitalize } }}</p>
<!-- Output: Hello -->

FileSizePipe

Converts a file size in bytes into a human-readable format (e.g., KB, MB, GB).

<p>{{ 1024 | fileSize }}</p>
<!-- Output: 1 KB -->

HidePipe

Hides sensitive information by masking characters.

<p>{{ '1234567890' | hide }}</p>
<!-- Output: ********* -->

Base64ImgUrlPipe

Converts a base64-encoded image to a data URL for display.

<img [src]="'data:image/png;base64,iVBORw0KG...' | base64ImgUrl" alt="Image" />

LocalizedPipe

Formats a date or number based on the user's locale.

<p>{{ someDate | localized: 'short' }}</p>

RoundHalfPipe

Rounds a number using the "round half" method takes up or down as param.

<p>{{ 3.45 | roundHalfUp }}</p>
<!-- Output: 3.5 -->

UpperCaseFromPipe

Converts text to uppercase from a specified index.

<p>{{ 'hello' | upperCaseFrom: 2 }}</p>
<!-- Output: heLLO -->

ReplaceCommaPipe

Replaces commas with a specified separator.

<p>{{ '44,54' | replaceComma }}</p>
<!-- 44.54 -->

NumberToWordsPipe

Converting numbers into words.

<p>{{ 1000000 | numberToWords : 'en'}}</p>
<!-- One Million -->
<p>{{ 95 | numberToWords : 'fr'}}</p>
<!-- Quatre-vingt-Quinze -->
<p>{{ 1000000000000 | numberToWords : 'en'}}</p>
<!-- Number is too large to convert -->
<p>{{ 1000000000000 | numberToWords : 'fr'}}</p>
<!-- Le nombre est trop grand pour être converti -->

RemoveByKeyPipe

This Angular pipe is designed to filter an array of objects based on the value of a specified key.

<!-- items = [1,2,3] -->

<div *ngFor="let item of items | removeByKey: 'id': [1, 2]">
  <!-- Render item content here -->
</div>

CamelCaseToTitleSeparatedCasePipe

This pipe converts camel case strings into title separated case. It adds spaces before capital letters.

{{ 'camelCaseString' | camelCaseToTitleSeparatedCase }}
<!-- Output: 'camel Case String' -->

FormatInstanceofDatePipe

This pipe formats Date objects according to specified options. It also optionally includes time formatting.

{{ myDate | formatInstanceofDate }}
<!-- Output: 'Jan 1, 2022' -->

{{ myDate | formatInstanceofDate:true:true }}
<!-- Output: 'Jan 1, 2022 12:00 PM' -->

IncludesPipe

This pipe formats Date objects according to specified options. It also optionally includes time formatting.

<div *ngIf="items | includes:element">Element is included in the array</div>

RemoveDuplicatesByKeyPipe

This pipe removes duplicate objects from an array based on a specified key.

<div *ngFor="let item of arrayData | removeDuplicatesByKey:'id'">
  <!-- Display unique items -->
</div>

UnderscoreToTitlePipe

This pipe replaces underscores in strings with spaces.

{{ 'underscore_string' | underscoreToTitle }}
<!-- Output: 'underscore string' -->

CamelToSnakePipe

Convert camel case strings to snake case.

<p>{{ 'camelCase' | camelToSnake }}</p>
<!-- camel_case -->

SnakeToCamelPipe

Convert a string from snake case to camel case.

<p>{{ 'snake_case' | snakeToCamel }}</p>
<!-- snakeCase -->

Contribution

If you'd like to contribute to the extra-pipe library, feel free to open issues or submit pull requests on the GitHub repository. We welcome any suggestions, bug reports, or enhancements.

License

This library is released under the MIT License.

We hope you find the extra-pipe library helpful for enhancing your Angular applications. If you have any questions or need assistance, don't hesitate to reach out to our community or the library's maintainers. Happy coding!