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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 19x 17x 17x 2x 2x 1x 1x | /** * default function always returns false */ const defaultFunction = () => false; /** * Search for function within funcs object and return matchin name * @param {String} element - string representation of regex * @param {Object} funcs - object with functions provided by the user that may be part of the query * @returns {Functino} - Function with matchin name from funcs function */ const addFunctionToQuery = (element, funcs) => { if (funcs[element] && typeof funcs[element] === 'function') { return funcs[element]; } return defaultFunction; }; module.exports = addFunctionToQuery; |