one-validation

Regexp based validation collection for common internet validation tasks

39 个版本
安装
npm install one-validation
yarn add one-validation
pnpm add one-validation
bun add one-validation
README

one-validation

NPM version Build Status Coverage Status Dependency Status

This is a collection of regular expressions for general validation purposes. The basic design concept is to split up the regexes into semantic parts of the pattern to match. As an example a url consists of many parts like scheme, optional userinfo, subdomain, domain, toplevel domain, path, query and fragment. It is a lot easier to write a maintainable and reusable regular expression by mathing each of these parts individually and write a regex that combines the individual later.

The library includes a TLD whitelist that can be updated using make.

This module works as a NodeJS CommonJS module, a require.js AMD module and falls back to exposing itself in the global scope on one.validation if included directly in the page.

Package managers:

  • npm: npm install one-validation
  • bower: bower install validation

Supported patterns

  • domain
  • email
  • url

Examples

domain and domainIdn

validation.domain.test('foo.co.uk');
return true;
validation.domainIdn.test('hällo-test.de');
return true;

email and emailIdn

validation.email.test('test@foo.co.uk');
return true;
validation.domainIdn.test('test@hällo-test.de');
return true;

Building

npm install
make
版本列表
2.2.3 2023-08-30
2.2.2 2018-06-04
2.2.1 2017-05-03
2.2.0 2015-06-15
2.1.0 2015-04-14
2.0.0 2014-10-28
1.2.0 2014-07-22
1.1.0 2014-07-21
1.0.0 2014-07-21
0.6.2 2014-06-13
0.6.1 2014-06-13
0.6.0 2013-12-02
0.5.0 2013-08-07
0.4.2 2013-05-28
0.4.1 2013-03-18
0.4.0 2013-03-14
0.3.0 2013-03-08
0.2.20 2013-02-26
0.2.19 2013-02-15
0.2.18 2013-01-11
0.2.17 2012-10-18
0.2.16 2012-09-22
0.2.15 2012-09-05
0.2.14 2012-08-16
0.2.13 2012-07-19
0.2.12 2012-06-29
0.2.11 2012-06-15
0.2.10 2012-05-22
0.2.9 2012-05-22
0.2.8 2012-05-08
0.2.7 2012-01-16
0.2.6 2012-01-16
0.2.5 2012-01-16
0.2.4 2012-01-13
0.2.3 2011-12-29
0.2.2 2011-12-28
0.2.1 2011-12-28
0.2.0 2011-12-28
0.1.0 2011-12-22