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.
validate
✓ import { validate } from 'resume-schema'
✗ const { validate } = require('resume-schema')
ESM imports work in Node >=20; CJS require() still works but ESM is preferred.
schema
✓ import { schema } from 'resume-schema'
✗ const schema = require('resume-schema').schema
Direct access to the raw schema object.
default
✓ import resumeSchema from 'resume-schema'
✗ const resumeSchema = require('resume-schema')
Default export is an object with validate and schema properties. CJS require returns this object.
validate (callback style)
✓ import { validate } from 'resume-schema'; validate(resume, (err, report) => {}, (err) => {})
✗ validate(resume, function(err, report) {})
The callback signature is (err, report) for first callback, and (err) optional for second callback. Missing second callback may cause unexpected error handling.
Validates a JSON resume object using the schema's validate function with callbacks.
import { validate } from 'resume-schema';
const resume = {
basics: { name: 'John Doe', label: 'Developer' },
work: [
{
company: 'Company',
position: 'Software Engineer',
startDate: '2020-01-01',
endDate: '2023-01-01'
}
],
education: [
{
institution: 'University',
area: 'Computer Science',
studyType: 'Bachelor',
startDate: '2016-09-01',
endDate: '2020-06-01'
}
]
};
validate(resume, (err, report) => {
if (err) {
console.error('Validation failed:', err);
} else {
console.log('Resume is valid:', report);
}
}, (err) => {
console.error('Validation error:', err);
});
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module /path/to/resume-schema/index.js from node_modules not supported.
Using require() in a CommonJS file when the package is ESM-only (Node >=20).
fixUse import instead of require, or rename file to .cjs
TypeError: resumeSchema.validate is not a function
Incorrect import: using default import but expecting a function.
fixUse import { validate } from 'resume-schema' Audit
Dependencies
No dependency data recorded yet.