@sineverba/validate
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published
CI / CD Status
NPM npm version
Semaphore CI Build Status
Circle CI CircleCI
Coverall Coverage Status
SonarCloud Quality Gate Status

validate validates a string. If string is valid, return true.

Useful in forms.

It validates an email or against an external regular expression.

You can pass a second parameter as true to use a third parameter as regular expression.

Installation

npm install @sineverba/validate

Usage

import { validate } from "@sineverba/validate";

console.log(validate("info@example.com")); // It prints true
console.log(validate("infoexample.com")); // It prints false
console.log(validate("qwerty1234_", true, /^[a-zA-Z0-9_]+$/)); // It prints true, accept only alfphanumeric and underscore

Tests

npm run test for simple test

npm run coverage for coverage

Readme

Keywords

Package Sidebar

Install

npm i @sineverba/validate

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

4.88 kB

Total Files

5

Last publish

Collaborators

  • sineverba