This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ########################################################################################### | |
const noParams = () => { // Función auxiliar que maneja la ausencia de parámetros | |
// Tenemos que determinar el nombre de la función que nos está llamando. | |
// Este se encuentra en el trazado de pila, tercera línea, segunda palabra. | |
const parentFunc = new Error().stack.split('\n')[2].trimStart().split(' ')[1] | |
throw new Error(`Function "${parentFunc}" must be called with a parameter`) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ####################################################################### | |
// En jsconfig.json: | |
{ | |
"compilerOptions": { | |
"baseUrl": "./src", | |
"paths": { | |
"@/*": ["*"] | |
} | |
} | |
} |