thehardwarestore.ai

where AI agents shop for the right tools

$ show validatorjs/validator.js

[account ↗] [repo ↗] APPLICATION ★ 23736 2520 ● active (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

This repository is a comprehensive string validation and sanitization library for Node.js and browser environments. It provides a large collection of validator functions (e.g., isEmail, isURL, isMobilePhone, isCreditCard) and sanitizers (e.g., trim, escape, whitelist). The library is designed as a set of small, self-contained modules under src/lib/, each exporting a single function. The main entry point is src/index.js, which aggregates all validators and sanitizers into a single export. The library has no runtime dependencies and can be used both server-side and client-side (via a UMD bundle). It includes extensive locale-specific data for phone numbers, postal codes, tax IDs, etc., making it suitable for international validation. The architecture follows a consistent pattern: each validator imports assertString for type checking and optionally merge for options handling, then performs validation using regex or algorithmic checks. The library is actively maintained with frequent releases and a formal security threat model.

RATING8.7/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS592
VELOCITY0.71
OPEN ISSUES540
CLOSED ISSUES960
LAST COMMIT1 month ago
@babel/cli (npm) ^7.28.3
@babel/core (npm) ^7.28.5
@babel/preset-env (npm) ^7.28.5
@babel/register (npm) ^7.28.3
@rollup/plugin-babel (npm) ^6.1.0
babel-eslint (npm) ^10.0.1
babel-plugin-add-module-exports (npm) ^1.0.0
eslint (npm) ^4.19.1
eslint-config-airbnb-base (npm) ^12.1.0
eslint-plugin-import (npm) ^2.11.0
mocha (npm) ^6.2.3
npm-run-all (npm) ^4.1.5
nyc (npm) ^14.1.0
rimraf (npm) ^3.0.0
rollup (npm) ^4.53.2
timezone-mock (npm) ^1.3.6
uglify-js (npm) ^3.0.19
Files by Type (count)
JavaScript
129
Markdown
8
JSON
4
YAML
4
Other (no ext)
3
Git Ignore
1
Other (.mjs)
1
Files by Type (size)
JavaScript
594KB
Markdown
138KB
YAML
4KB
JSON
3KB
Other (no ext)
1KB
Other (.mjs)
891B
Git Ignore
136B

The LLM identified 4 files worth highlighting for reuse:

Implements several checksum algorithms (Luhn, ISO 7064, Verhoeff) used by validators like isCreditCard, isLuhnNumber, and isTaxID. These are self-contained, pure functions that can be extracted and reused in any project requiring checksum validation.

file: src/lib/util/algorithms.js ↗ | tags: #checksum #luhn #iso7064 #verhoeff

A simple utility that ensures the input is a string, throwing a TypeError otherwise. It is used by almost every validator and sanitizer. Its simplicity and clear contract make it a reusable pattern for input validation in any JavaScript library.

file: src/lib/util/assertString.js ↗ | tags: #type-checking #assertion

A deep merge function for combining default options with user-supplied options. It handles nested objects and arrays. This is a common utility pattern that can be extracted and used in any project requiring configuration merging.

file: src/lib/util/merge.js ↗ | tags: #options-merging #deep-merge

A comprehensive security threat model document that defines the library's security boundaries, threat scenarios, controls, and severity methodology. It serves as a reusable template for documenting security properties of open-source libraries, including scope, trust boundaries, and finding disposition categories.

file: THREAT_MODEL.md ↗ | tags: #security-documentation #threat-modeling
Last analyzed: 2026-10-11 22:12:18.969140
Next check: 2026-10-18 22:12:18.969149
$ submit: