All files mdLinks.js

88.89% Statements 8/9
50% Branches 2/4
100% Functions 3/3
85.71% Lines 6/7

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 51 52 53 54 55 56 57 58 59 60                                  1x 1x       1x 1x     1x             1x                                                    
import { getLinks, optionValidate } from './utils1.js'
// const functionMdLinks = require('./utils1.js');
 
 
//  export const mdLinks = (route, options) => {
//   const links = new Promise((resolve) => {
//     if (options.validate === true) {
//       resolve(optionValidate(route));
//     }
//     if (options.validate === false) {
//       resolve(getLinks(route));
//     }
//   });
//   return links;
// };
 
// export default mdLinks;
const mdLinks = (route, options) => {
  Iif (options.validate === true) {
    return optionValidate(route)
    // .then(resp => resp).catch(err => err);  
  } 
  Eif (options.validate === false) {
    return new Promise(resolve => resolve(getLinks(route)));
  } 
};
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 }))