Created
April 24, 2020 20:45
-
-
Save kenanhancer/f26afafe3604ec1cbd4b74380db8977f to your computer and use it in GitHub Desktop.
uni-ioc classic code example
This file contains hidden or 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 helper = require('./helper'); | |
const greetingService = { | |
sayHello: ({ firstName, lastName }) => { | |
const fullName = helper.getFullName({ firstName, lastName }); | |
return `Hello ${fullName}`; | |
}, | |
sayGoodbye: ({ firstName, lastName }) => { | |
const fullName = helper.getFullName({ firstName, lastName }); | |
return `Goodbye, ${fullName}`; | |
} | |
}; | |
module.exports = greetingService; |
This file contains hidden or 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 helper = { | |
getFullName: ({firstName, lastName})=>{ | |
return `${firstName} ${lastName}`; | |
} | |
}; | |
module.exports = helper; |
This file contains hidden or 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 greetingService = require('./greeting-service'); | |
const helloMsg = greetingService.sayHello({firstName: "kenan", lastName: "hancer"}); | |
console.log(helloMsg); | |
const goodBydMsg = greetingService.sayGoodbye({firstName: "kenan", lastName: "hancer"}); | |
console.log(goodBydMsg); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment