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

@goodbetterbist/input-validators

v0.0.7

Published

InputNumberValidator prevents users from entering values based on input field attributes.

Downloads

11

Readme

@goodbetterbist/input-validators

InputNumberValidator prevents users from entering values based on input field attributes.

Installation

To install this library, run:

npm i @goodbetterbist/input-validators

Usage

TypeScript

Import the InputValidatorsModule:

import { InputValidatorsModule } from '@goodbetterbist/input-validators';

@NgModule({
  imports: [
     ...,
    InputValidatorsModule
  ],
    ...
})
export class AppModule { }

HTML

Use the inputNumberValidator directive in your input fields for numbers only.
<input type="text" inputNumberValidator />
For min & max value
<!-- To input numbers between 1 & 100  -->
<input
type="text"
inputNumberValidator
placeholder="00"
[min]="1"
[max]="100"
/>
To disable copy and paste
<input
type="text"
inputNumberValidator
[disableCopy] = 'true'
[disablePaste] = 'true'
/>
To allow decimal numbers
<input
type="text"
inputNumberValidator
[allowDecimal]="true"
/>
<!-- to allow decimal numbers in an input field -->
To limit decimal places
<input
type="text"
inputNumberValidator
placeholder="00"
[limitDecimalPlaces]="2"
/>
<!-- limits the number of decimal places allowed in an input field -->
To allow negative numbers
<input
type="text"
inputNumberValidator
placeholder="00"
[allowNegative]="true"
/>

Attributes with usage

| Attribute|Usage| Description| |--------------------------------|----------------|------------------------------------------------------------- | | inputNumberValidator | <input type="text" inputNumberValidator /> | Allow to use numbers only | | min | <input type="text" inputNumberValidator [min]="2" /> | Prevents from entering less than minimum | | max | <input type="text" inputNumberValidator [max]="100" /> | Prevents from entering more than maximum | | disableCopy | <input type="text" inputNumberValidator [disableCopy]="true" /> | Prevents from copying input value | | disablePaste | <input type="text" inputNumberValidator [disablePaste]="true" /> | Prevents from pasting value | | allowDecimal | <input type="text" inputNumberValidator [allowDecimal]="true" /> | To allow decimal numbers | | limitDecimalPlaces | <input type="text" inputNumberValidator [limitDecimalPlaces]="2" /> | To limit decimal places | | allowNegative | <input type="text" inputNumberValidator [allowNegative]="true" /> | To allow negative numbers |