All files stats.js

100% Statements 8/8
100% Branches 0/0
100% Functions 5/5
100% Lines 6/6

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 61 62 63 64 65 66 67 68 69 70 71                                                                                                            1x 1x         1x 11x         1x 11x      
 
// const arrLinks = [
//     // {
//     //   href: '#1-preámbulo',
//     //   text: '1. Preámbulo',
//     //   file: 'C:\\Users\\HP\\MD-links\\LIM013-fe-md-links\\README.md',
//     //   status: 500,
//     //   statusText: 'FAIL'
//     // },
//     {
//       href: '#5-criterios-de-aceptación-mínimos-del-proyecto',
//       text: '5. Criterios de aceptación mínimos del proyecto',
//       file: 'C:\\Users\\HP\\MD-links\\LIM013-fe-md-links\\README.md',
//       status: 500,
//       statusText: 'FAIL'
//     },
//     {
//       href: 'https://nodejs.org/es/',
//       text: 'Node.js',
//       file: 'C:\\Users\\HP\\MD-links\\LIM013-fe-md-links\\README.md',
//       status: 200,
//       statusText: 'OK'
//     },
//     {
//       href: 'https://developers.google.com/v8/',
//       text: 'motor de JavaScript V8 de Chrome',
//       file: 'C:\\Users\\HP\\MD-links\\LIM013-fe-md-links\\README.md',
//       status: 200,
//       statusText: 'OK'
//     },
//     {
//         href: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export',
//         text: '<code>export</code>',
//         file: 'C:\\Users\\HP\\MD-links\\LIM013-fe-md-links\\README.md',
//         status: 200,
//         statusText: 'OK'
//     },
//     {
//       href: 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export',
//       text: '<code>export</code>',
//       file: 'C:\\Users\\HP\\MD-links\\LIM013-fe-md-links\\README.md',
//       status: 200,
//       statusText: 'OK'
//     },
//     {
//         href: '#3-objetivos-de-aprendizaje',
//         text: '3. Objetivos de aprendizaje',
//         file: 'C:\\Users\\HP\\MD-links\\LIM013-fe-md-links\\README.md',
//         status: 500,
//         statusText: 'FAIL'
//       },
    
// ];
 
export const linksStats = (arrObj) => {
    return arrObj.length;
  };
    
//   console.log('total Links: ' + linksStats(arrLinks));
  
  export const uniqueStats = (arrObj) => {
    return new Set(arrObj.map((links) => links.href)).size;
  }; 
    
//   console.log('unique: ' + uniqueStats(arrLinks));
  
  export const brokenStats = (arrObjValidate) => { 
    return arrObjValidate.filter(link => link.status >= 400).length;
  };
 
  // console.log('broken: ' + brokenStats(arrLinks));