-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chapter 04: example of a serviceContainer that implements a interface…
… that violates the interface segregation principle
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
chapter-04-the-interface-segregation-principle/serviceContainer.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* In order to improve the understanding of this code, this file it is supposing to implement the following interface: | ||
* | ||
* interface ServiceContainerInterface { | ||
* function get(name); | ||
* function set(name, fn); | ||
* } | ||
* | ||
* Quack Quack Quack 🦆 typing :D | ||
*/ | ||
|
||
function serviceContainer() { | ||
function get(name) { | ||
// something here... | ||
} | ||
|
||
function set(name, fn) { | ||
// something here | ||
} | ||
|
||
return { | ||
get, | ||
set, | ||
}; | ||
} | ||
|
||
module.exports = serviceContainer; |