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

@kuro-samurai/ngx-samurai-filter

v1.0.2

Published

Filter your data with samurai filter pipe

Downloads

36

Readme

Samurai Filter

Filter your data with Samurai Filter Pipe

Features Overview

This pipe has:

  • 2 Filters For boolean Type Values
  • 4 Filters For string Type Values
  • 6 Filters For number Type Values

You can use this pipe in your template or your component to
filter your data with any condition you want and it is simple and easy!

Installation

This pipe supports Angular 16 and higher

Run the code below in your project terminal:

ng add @kuro-samurai/ngx-samurai-filter

Use

Type: standalone
Name: SamuraiFilter
Return Type: any[]

Importing The Pipe

  • If your component is standalone, import the pipe to your
    @Component decorator:

    @Component({
      //...
      standalone: true,
      imports: [CommonModule, FilterPipe],
      //...
    })
  • Else import it to your component's module:

    @NgModule({
      //...
      imports: [CommonModule, FilterPipe],
      //...
    })

Available Conditions For Value Types

  • boolean
    • equal
    • notEqual
  • string
    • equal
    • notEqual
    • include
    • notInclude
  • number
    • equal
    • notEqual
    • equal/greater
    • equal/lower
    • greater
    • lower

Examples

Filter Value Boolean

<div *ngFor="let user of users | SamuraiFilter : 'verified' : true : 'equal'">
 <p>{{ user.name }}</p>

 <p>{{ user.age }}</p>
</div>

In the exmaple above, users that are verified true will pass the filter.


Filter Value Number

<div *ngFor="let user of users | SamuraiFilter : 'age' : 13 : 'equal/greater'">
 <p>{{ user.name }}</p>

 <p>{{ user.age }}</p>
</div>

In the exmaple above, users that are 13 years old or older will pass the filter.


Filter Value String

<div *ngFor="let user of users | SamuraiFilter : 'name' : 'David' : 'include'">
 <p>{{ user.name }}</p>

 <p>{{ user.age }}</p>
</div>

In the exmaple above, users that their name include David will pass the filter.

Using Pipe With *ngIf Directive

<ng-container *ngIf="data | async as users">
 <div *ngFor="let user of users | SamuraiFilter : 'age' : 13 : 'equal/greater'">
  <p>{{ user.name }}</p>

  <p>{{ user.age }}</p>
 </div>
</ng-container>

In the exmaple above, after data was recieved from backend,
users that are 13 years old or older will pass the filter.

For more info about async pipe go to Async Pipe Documentation

Properties (Inputs)

Related Resources

To see my other packages visit my npm page

I have a UI kit which you can see the demo here

Future Plans

The following features will be added soon:

  • Implementing advanced filter conditions

Developer Words

I learned programming for free on the web. Now I want to return
the love to programmers community. I plan to make a free UI kit for
angular and this package is one of many free packages I will publish on npm.

Contributors