All files utils.js

100% Statements 7/7
100% Branches 0/0
100% Functions 2/2
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                                137x                 52x 52x 67x   52x     1x        
/**
 * Universidad de La Laguna
 * Escuela Superior de Ingeniería y Tecnología
 * Grado en Ingeniería Informática
 * Procesadores de Lenguajes
 *
 * @author Juan Rodríguez Suárez
 * @since Mar 04 2024
 * @desc Contains some utility functions.
 */
 
/**
 * @brief Returns the string '$' + id
 * @param {string} id - The input
 * @returns {string} The output
 */
const $ = id => '$' + id;
 
/**
 * @brief Calculates the difference between two sets.
 * @param {Set} setA - The first set
 * @param {Set} setB - The second set
 * @returns {Set} The difference
 */
function difference(setA, setB) {
  let difference = new Set(setA);
  for (const ELEMENT of setB) {
    difference.delete(ELEMENT);
  }
  return difference;
}
 
module.exports = {
  $, 
  difference
};