Skip to content

Instantly share code, notes, and snippets.

@fransafu
Last active February 7, 2020 00:13
Show Gist options
  • Save fransafu/5c02e80f8e9e91b3c5cb2cd727f851d6 to your computer and use it in GitHub Desktop.
Save fransafu/5c02e80f8e9e91b3c5cb2cd727f851d6 to your computer and use it in GitHub Desktop.
Ejemplo de uso de modulo propio en Node.js
// checkIfString verifica si el parametro corresponde a un String
const checkIfString = (str) => {
if (typeof str === 'string' || str instanceof String) {
return true;
}
return false;
}
// checkIfNumber verifica si el parametro ingresado corresponde a un Numero
const checkIfNumber = (num) => parseInt(num) === num;
module.exports = {
checkIfString,
checkIfNumber,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment