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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 556x 11x 11x 11x 6x 1x 1x 5x 5x 11x 11x 545x 545x 1x 1x | const makeObject = require('../../handlers/make/makeObject'); /** * Merge two Objects containing functions into a single object * @param {Object} localFunctions - local object containing functions for specific query * @param {Object} globalFunctions - object containing functions for all queries * @returns {Object} - merged localFunctions and globalFunctions */ const mergeFunctions = (localFunctions, globalFunctions) => { if (localFunctions) { const local = makeObject(localFunctions); const allFunctions = { ...globalFunctions }; Object.keys(local).forEach((key) => { if (allFunctions[key]) { throw new Error(`Conflicting function name ${key}.`); } allFunctions[key] = local[key]; }); return allFunctions; } return globalFunctions; }; module.exports = mergeFunctions; |