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

validators-pl

v1.0.0

Published

Validators for polish address and ID data

Downloads

14

Readme

Build Status Codacy Badge Codacy Badge

Polish validators

Simple set of validators to validate polish data. Useful in any type of online forms.

Browser and NodeJS support

Library currently supports all the browsers that have > 5% of market share and current LTS versions of NodeJS.

The library code is minified. For the original code, please refer to the GitHub repo.

Library methods are exposed both as classic module.exports and ES6 exports.

Adding to a project

To use library, install it with npm or yarn:

  • npm i --save validators-pl
  • yarn add validators-pl

Standard module imports

For the standard environment, use require or amd:


const validators = require('validators-pl');
const isValidPesel = validators.isValidPesel(89101012345);

ES6 imports

Using ES6 imports, you can include only the part of library that you need (which is useful for tree shaking and minifying, supported by tools like Webpack):


import {isValidPesel} from 'validators-pl';
const isValidPesel = isValidPesel(89101012345);

Available validators

Provided validators are related only to polish ID data.

| Method name | Parameters | Description | |----------------------|-----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| | isComplexPassword | String password | Checks the password complexity. Follows simple regEx rules: one digit, one lowercase, one uppercase letter and one special character from the list: $@!%*?& | | isName | String name | Checks if the provided name contains only polish alphabet letters and is a valid polish name | | isLocationNumber | String number | Checks if the passed number is a valid location number (e.g. apartment, street number) | | isPostalCode | String postCode | Checks if provided string is a valid Polish postal code | | isCompliantWithPesel | String/Date date, String pesel | Checks if the provided date matches given PESEL (does not check PESEL validity!!! - check the next method) | | isValidPesel | String pesel | Checks if the given PESEL is a valid PESEL number | | isValidIdNo | String idNo | Checks if the given string is a valid identification number | | isValidPassportNo | String passportNo | Checks if the provided number is a valid passport number | | isValidNip | String nip | Checks if the provided number is a valid NIP |

Testing

Tests can be run by running npm test from the library directory.