UNPKG

json-schema-spell-checker

Version:

Check the spelling of your JSON Schema (including OpenAPI!) documents

20 lines (17 loc) 538 B
const strip = require("remark-plain-text"); const remark = require("remark"); const spellcheck = require("markdown-spellcheck").default; const check = async (item, options) => { return new Promise((resolve, reject) => { remark() .use(strip) .process(item.value, (error, result) => { if (error) { reject(error); } const errors = spellcheck.spell(result.contents, options); resolve({ errors, plain: result.contents.trim(), ...item }); }); }); }; module.exports = check;