Registry / testing / vex
library0.0.4jsnpmunverified

Vex is a simple schema validator for JavaScript objects, supporting Node.js and browser environments (UMD build). The npm package is at version 0.0.4 with an unstable release cadence. It allows defining schemas with type constraints (String, Number, etc.), optional/required fields, argument schemas, and custom assertion functions. Unlike Joi or Yup, Vex is minimal with no dependencies but lacks active maintenance.

npm install vex
INSTALL
IMPORT
SIG · VEX
V
vex
testingjavascriptv0.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import vex from 'vex'
const vex = require('vex')
This package is ESM-only since v0.0.4? Actually, it uses CommonJS. Use require('vex') in Node.
vex
const vex = require('vex')
import { vex } from 'vex'
CommonJS import is correct; named import does not exist.
vex.status
const vex = require('vex'); vex.status()
import { status } from 'vex'
status is a method on the default export, not a separate export.

Validates an object against a schema using Vex. Shows basic usage with String and Number types, and error handling via status().

const vex = require('vex'); const schema = { name: String, age: Number }; const config = { name: 'Alice', age: 30 }; const isValid = vex(config, schema); if (isValid) { console.log('Valid'); } else { console.error('Invalid:', vex.status()); }
Debug
Known issues
deprecatedPackage is no longer maintained; consider using Joi, Yup, or Zod.
fix
Migrate to a maintained validator like Zod or Joi.
affects: >=0.0.0
gotchavex throws by default if schema validation fails; must set settings.throw to false to avoid exceptions.
fix
Use vex.settings.throw = false before calling vex()
affects: >=0.0.0
gotchavex returns true when schema is invalid (vexed); logic may be counterintuitive.
fix
Check if vex() returns true to handle invalid state.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: vex is not a function
Using import { vex } from 'vex' instead of const vex = require('vex')
fix
Use require('vex') or import vex from 'vex'
Cannot find module 'vex'
vex not installed or not in node_modules
fix
Run npm install vex
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
Resources
packagevex
vex — npm install vex · libregistry