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

@ngx-reusable/common

v14.2.2

Published

**@ngx-reusable** project is an **Angular** library that contains a collection of components, directives and pipes that we need in any project

Downloads

6

Readme

@ngx-reusable

@ngx-reusable project is an Angular library that contains a collection of components, directives and pipes that we need in any project

@ngx-reusable/common

@ngx-reusable/common library contains multiple resuable directives and pipes.

versions

| Angular Version | @ngx-reusable/common | | --------------- | ----------------------- | | 14 | @ngx-reusable/common@14 |

Directives

add ReusableDirectivesModule to your module:

import { ReusableDirectivesModule } from "@ngx-reusable/common/directives";
  • Confirm:

    • selector: [confirm]
    • usage: launch confirm prompt on element click:
    • @Input() message?: string;
    • @Output() confirmed: EventEmitter<void>;
    • @Output() cancelled: EventEmitter<void>;

    Example: <button confirm message="Are you sure?" (confirmed)="doSomething()">

  • MiddleClick:

    • selector: [mdlclick]
    • usage: emit an event on mouse middle button click:
    • @Output('mdlclick') event: EventEmitter<MouseEvent>;

    Example: <button (mdlclick)="doSomething()">

  • RightClick:

    • selector: [rtclick]
    • usage: emit an event on mouse right button click:
    • @Output('rtclick') event: EventEmitter<MouseEvent>;

    Example: <button (rtclick)="doSomething()">

  • CopyToClipboard:

    • selector: [copyToClipboard]
    • usage: copy text to clipboard on element click:
    • @Input('copyToClipboard') text!: string;

    Example: <button [copyToClipboard]="someTextToCopy">

  • PasteFromClipboard:

    • selector: [pasteFromClipboard]
    • usage: paste text from clipboard to formControl and emit event with text on element click:
    • @Output('pasteFromClipboard') paste: EventEmitter<string>;

    Example: <button (pasteFromClipboard)="getSomeText($event)">

Pipes

Array Pipes

Add ability to use native JavaScript array methods in HTML.

add ReusableArrayPipesModule to your module:

import { ReusableArrayPipesModule } from "@ngx-reusable/common/pipes";
  • FilterPipe:

    • {{ array | filter: property: operator: expected }}
    • property: for objects array to select property
      • pass "" if array isn't array of objects
      • pass property name if proeprty is one level
      • if nested property pass it like: level1.level1
    • operator: ==, !=, <>, <, <=, >, >=, ===
    • expected: required value

    Example: {{ arr | filter: 'count': '>=': 10 }} will be translated to: arr.filter(item => item['count'] >= 10)

  • JoinPipe:

    • {{ array | join [: seperator] }}
    • seperator: join method seperator

    Example: {{ arr | join: ',' }} will be translated to: arr.join(',')

Object Pipes

Add ability to use native JavaScript object methods in HTML. add ReusableObjectPipesModule to your module:

import { ReusableObjectPipesModule } from "@ngx-reusable/common/pipes";
  • EntriesPipe:

    • {{ object | entries }}

    Example: *ngFor="let [key, value] for (object | entries)"

  • KeysPipe:

    • {{ object | keys }}

    Example: *ngFor="let key for (object | keys)"

  • ValuesPipe:

    • {{ object | values }}

    Example: *ngFor="let value for (object | values)"

String Pipes

Add ability to use native JavaScript string methods in HTML. add ReusableStringPipesModule to your module:

import { ReusableStringPipesModule } from "@ngx-reusable/common/pipes";
  • SplitPipe:

    • {{ str | split [: splitter [:limit]] }}
    • splitter: split string by (default = "").
    • limit: limit number of generated items.

    Example: *ngFor="let item for (strLikeArray | split: ',')"