All files / src/md-Links mdLinks.js

100% Statements 6/6
75% Branches 3/4
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50            1x 2x 1x     1x 1x                                                                          
import { getLinks, optionValidate } from './utils1.js'
// const functionMdLinks = require('./utils1.js');
 
 
 
// export default mdLinks;
  export const mdLinks = (route, options) => {
  if (options.validate === true) {
    return optionValidate(route)
    // .then(resp => resp).catch(err => err);  
  } 
  Eif (options.validate === false) {
    return new Promise(resolve => resolve(getLinks(route)));
  } 
};
// export default mdLinks;
// module.exports = mdLinks;
 
 
 
 
// console.log('Prueba de mdLinks, validate false');
// console.log(mdLinks('prueba1.md', { validate: true })); 
// mdLinks('./test/prueba/Documento/prueba4.md', { validate: false }).then(res=>console.log(res));
// mdLinks('./test/prueba/Documento/prueba4.md',{validate:true}).then(res=>console.log(res));
// console.log(''); 
 
// const mdLinks = (path, options) => {
//   const allLinks = new Promise((resolve, reject) => {
//       if (functionMdLinks.pathValid(path)) {
//           if (options.validate === false) {
//               resolve(functionMdLinks.getLinks(path));
//           } else if (options.validate === true) {
//               return (functionMdLinks.optionValidate(path).then((links) => resolve(links)));
//           } else {
//               // reject ((new Error('Option invalidate: ')).message)
//               reject('Parametro invalido ');
//           }
//       } else {
//           // reject ((new Error('Path is not valid ')).message)
//           reject(console.log('Path is not valid'))
//       }
//   });
//   return allLinks;
// };
// // mdLinks(ruta1, option1).then(res => console.log(res));
 
// module.exports = { mdLinks };
// console.log(mdLinks('prueba1.md', { validate: true })); 
// // console.log(mdLinks('README.md', { validate: false }))