udemy-node-tests/utils/utils.js
Tyrel Souza 264c681dc7 initial
2017-11-28 22:14:07 -05:00

21 lines
438 B
JavaScript

module.exports.add = (a, b) => a + b;
module.exports.asyncAdd = (a, b, callback) => {
setTimeout(() => {
callback(a + b);
}, 50);
}
module.exports.square = (x) => x * x;
module.exports.asyncSquare = (a, callback) => {
setTimeout(() => {
callback(a * a);
}, 50);
}
module.exports.setName = (user, fullName) => {
var names = fullName.split(" ");
user.firstName = names[0];
user.lastName = names[1];
return user;
}