All files / src/commands commandRegistry.js

100% Statements 17/17
100% Branches 8/8
100% Functions 1/1
100% Lines 17/17

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 185x 5x 1x 1x 4x 4x 25x 1x 1x 24x 24x 4x 5x 2x 2x 2x 2x  
function registerCommands(vscodeApi, commandHandlers) {
  if (!vscodeApi?.commands?.registerCommand) {
    throw new Error("VS Code API no valida para registrar comandos");
  }
 
  return Object.entries(commandHandlers).map(([commandId, handler]) => {
    if (typeof handler !== "function") {
      throw new TypeError("Handler invalido para registro de comando");
    }
 
    return vscodeApi.commands.registerCommand(commandId, handler);
  });
}
 
module.exports = {
  registerCommands,
};