New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

dynreg

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dynreg

Dynamically generated regularization

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

dynreg coverage test

Getting started

Install with npm:

npm install dynreg -S

Then require and use it in your code:

const { dynreg } = require('dynreg');

// Generates a nums-only reg, Any of the following methods will do
dynreg('n').test(3) === true;
dynreg('N') === new Regex('^[0-9]$');
dynreg(['N']);
dynreg(['n']);

API

Dynreg currently provides only one API to generate the regex required for form validation.

It returns a regular expression object.

dynreg

dynreg(Input);

For Input, They can be a combination of any letters in ['A','N','S','C'], The following formats are supported

dynreg('na')  | dynreg(['n', 'a'])// 支持手动输入数字(N)、字母(A)
dynreg('nac') | | dynreg(['n', 'a', 'c']) // 支持手动输入数字(N)、字母(A)、文字(C)
dynreg('nacs') | dynreg(['n', 'a', 'c', 's'])// 支持手动输入数字(N)、字母(A)、文字(C)、符号(S)
dynreg('n') | dynreg(['n'])// 支持手动输入数字(N)

Notice: ['A','N','S','C'] is not case sensitive

Keywords

reg

FAQs

Package last updated on 13 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts