🌐
npm
npmjs.com › package › validator
validator - npm
<script type="text/javascript" src="validator.min.js"></script> <script type="text/javascript"> validator.isEmail('foo@bar.com'); //=> true </script>
      » npm install validator
    
Published   Dec 18, 2025
Version   13.15.26
Author   Chris O'Hara
🌐
npm
npmjs.com › package › validate.js › v › 0.13.1
validate.js - npm
June 15, 2019 - Validate.js provides a declarative way of validating javascript objects.
      » npm install validate.js
    
Published   Jun 15, 2019
Version   0.13.1
Author   Nicklas Ansman
🌐
npm
npmjs.com › package › validate
validate - npm
January 13, 2022 - Validate object properties in javascript.. Latest version: 5.2.0, last published: 4 years ago. Start using validate in your project by running `npm i validate`. There are 155 other projects in the npm registry using validate.
      » npm install validate
    
Published   Jan 13, 2022
Version   5.2.0
Author   Eivind Fjeldstad
🌐
Validatejs
validatejs.org
validate.js
There are no required external dependencies at all! Though for the datetime and date validator to you need to specify a parse and format function and for that you most likely will want to use a library, moment.js is highly recommended.
🌐
npm
npmjs.com › package › validatorjs
validatorjs - npm
December 3, 2020 - npm · Sign UpSign In · 3.22.1 • Public • Published 5 years ago · Readme · Code Beta · 0 Dependencies · 204 Dependents · 72 Versions · The validatorjs library makes data validation in JavaScript very easy in both the browser and Node.js.
      » npm install validatorjs
    
Published   Dec 03, 2020
Version   3.22.1
Author   David
🌐
Medium
medium.com › @barathkumark › validator-npm-nodejs-3b833521856f
Validator NPM Nodejs. The validator npm package is a popular… | by Barath Kumar | Medium
January 28, 2023 - Validator NPM Nodejs The validator npm package is a popular library for string validation and sanitization in Node.js. It can be used to validate and sanitize various types of data, such as email …
🌐
Stack Abuse
stackabuse.com › data-validation-in-nodejs-with-validatorjs
Form Data Validation in Node.js With Validator.js
September 22, 2023 - In this article, we'll be performing form data validation using Validator.js - a lightweight NPM package built exactly for this purpose.
🌐
Express Validator
express-validator.github.io › introduction
express-validator | express-validator
express-validator is a set of express.js middlewares that wraps the extensive collection of validators and sanitizers offered by validator.js.
Find elsewhere
🌐
npm
npmjs.com › package › js-validate
js-validate - npm
June 26, 2018 - Latest version: 2.0.1, last published: 7 years ago. Start using js-validate in your project by running `npm i js-validate`. There are 2 other projects in the npm registry using js-validate.
      » npm install js-validate
    
Published   Jun 26, 2018
Version   2.0.1
Author   K. Shunz
🌐
npm
npmjs.com › package › just-validate
just-validate - npm
November 13, 2023 - Modern, simple, lightweight (~5kb gzip) form validation library written in Typescript, with no dependencies (no JQuery!). Support a wide range of predefined rules, async, files, dates validation, custom error messages and styles, localization.
      » npm install just-validate
    
Published   Nov 13, 2023
Version   4.3.0
Author   Georgii Perepecho
Top answer
1 of 2
11

They are used for different scenarios:

  • validator is a library to validate any kind of object and it's not associated with any framework.

  • express-validator uses validator library to validate expressjs routes. Basically you can validate express routes out of the box using validator lib.

In my honest opinion you can easily create your own validator middleware. Specially if you are new to Node.js it will help you to understand how middlewares work. If you are not interested on that and you have an express application feel free to use express-validator

Also I really recommend JOI as a validator lib https://github.com/hapijs/joi it's simple and it works well.

Here is an example of a middleware (I have not tested)

const Joi = require('joi')
module.exports = function validate(joiSchema) {
  return async (req, res, next) => {
    const result = Joi.validate(req.body, joiSchema, {
      allowUnknown: true,
      abortEarly: false
    })

    if (result.error) {
      throw new result.error
    }

    await next()
  }
}

  // express route
  router.post(
    '/create',
    validateMiddleware({
      body: {
        body: { firstName: Joi.string(), lastName: Joi.string() }
      }
    }),
    (req, res, next) => {
    // your logic
   })
2 of 2
0

Express-validator is used as middleware, the idea with express-validator is to check bad input before it reaches your controller.

Now, if you are using validator, you can make your own validation function in which you will simply pass the data and it will tell if the input is in accordance to it (Just like checking an Email, here you can have a function, which will check if input given to it is a function or not).

In case you are using Services in your structure, then you can use validator as I feel it's easy and of more control than express-validator

🌐
Jqueryvalidation
jqueryvalidation.org
jQuery Validation Plugin | Form validation with jQuery
NPM: npm i jquery-validation · https://cdn.jsdelivr.net/npm/jquery-validation@1.19.5/dist/jquery.validate.js · https://cdn.jsdelivr.net/npm/jquery-validation@1.19.5/dist/jquery.validate.min.js · https://cdn.jsdelivr.net/npm/jquery-validation@1.19.5/dist/additional-methods.js ·
🌐
Geekster
geekster.in › home › validator npm package
Validator npm Package With Example
June 26, 2024 - The Validator npm package is a powerful library designed for data validation in JavaScript applications.
🌐
npm
npmjs.com › package › validator.js-asserts
validator.js-asserts - npm
npm · Sign UpSign In · 9.0.0 • Public • Published 2 months ago · Readme · Code Beta · 1 Dependency · 3 Dependents · 39 Versions · A set of extra asserts for validator.js. Install the package via npm: npm install --save validator.js-a...
      » npm install validator.js-asserts
    
Published   Jul 01, 2025
Version   9.0.0
🌐
LogRocket
blog.logrocket.com › home › how to handle data validation in node.js using validatorjs
How to handle data validation in Node.js using validatorjs - LogRocket Blog
June 4, 2024 - npm run dev · The application boilerplate comes with a simple endpoint that you can test. With the server running, run a GET request on http://localhost:7000/api/ using your favorite API client. Now, update the validate.js file inside the helper folder as seen below: const Validator = require('validatorjs'); const validator = async (body, rules, customMessages, callback) => { const validation = new Validator(body, rules, customMessages); validation.passes(() => callback(null, true)); validation.fails(() => callback(validation.errors, false)); }; module.exports = validator; The snippet above shows how to initialize the validatorjs package in AMD format.
🌐
npm
npmjs.com › package › node-input-validator
node-input-validator - npm
December 2, 2022 - const { Validator } = require('node-input-validator'); router.post('login', async (ctx) => { const v = new Validator(ctx.request.body, { email: 'required|email', password: 'required' }); const matched = await v.check(); if (!matched) { ctx.status = 422; ctx.body = v.errors; return; } });
      » npm install node-input-validator
    
Published   Dec 02, 2022
Version   4.5.1
Author   Harcharan Singh
🌐
Express Validator
express-validator.github.io
express-validator
If you are not redirected automatically, follow this link
🌐
npm
npmjs.com › package › @types › validator
@types/validator - npm
November 17, 2025 - npm install --save @types/validator · This package contains type definitions for validator (https://github.com/validatorjs/validator.js). Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/validator. Last updated: Mon, 17 Nov 2025 21:33:59 GMT ·
      » npm install @types/validator