Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
306 views
in Technique[技术] by (71.8m points)

node.js - how to connect ajv-errors library to my project?

I know it must be simple, but I cant figure out how to import ajv module with ajv-errors.

This is a standart import which works

import Ajv from 'ajv';

Down here the code from npmjs.com which i don't understand, I use import, so how import and require supposed to be connected together?

const Ajv = require("ajv").default
const ajv = new Ajv({allErrors: true})
// Ajv option allErrors is required 
require("ajv-errors")(ajv /*, {singleError: true} */)

And the last question: in this picture npmjs where is the errorMessages at ajv instance ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...