UNPKG
conversor-may-min-tarde
Version:
latest (1.0.0)
1.0.0
Paquete que transforma un texto entre mayúsculas y minúsculas.
conversor-may-min-tarde
/
index.js
11 lines
(10 loc)
•
277 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
function
transformarTexto
(
text, tipo
) {
if
(tipo ===
'mayusculas'
){
return
text.
toUpperCase
(); }
else
if
(tipo ===
'minusculas'
){
return
text.
toLowerCase
(); }
else
{
throw
new
Error
(
'Tipo no válido.'
); } }
module
.
exports
= transformarTexto;