Skip to content

Commit 1922cf0

Browse files
committed
chapter 03: splitting interfaces in order to avoid to need to throw an error or not make something if some user uses changeOwner in a class that not have implementation
1 parent f818d26 commit 1922cf0

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* In order to improve the understanding of this code,
3+
* this file it is supposing to implement the interface FileWithOwnerInterface
4+
*
5+
* interface FileInterface {
6+
* function rename(name);
7+
* }
8+
*
9+
*
10+
* interface FileWithOwnerInterface extends FileInterface {
11+
* function rename(name);
12+
* }
13+
*
14+
* Quack Quack Quack 🦆 typing :D
15+
*/
16+
17+
function dropboxFile() {
18+
function rename(name) {}
19+
20+
return {
21+
rename,
22+
};
23+
}
24+
25+
module.exports = dropboxFile;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* In order to improve the understanding of this code,
3+
* this file it is supposing to implement the following interface:
4+
*
5+
* interface FileInterface {
6+
* function rename(name);
7+
* function changeOwner(user, group);
8+
* }
9+
*
10+
*
11+
* Quack Quack Quack 🦆 typing :D
12+
*/
13+
14+
function localFile() {
15+
function rename(name) {}
16+
17+
function changeOwner(user, group) {
18+
//make something
19+
}
20+
21+
return {
22+
rename,
23+
changeOwner,
24+
};
25+
}
26+
27+
module.exports = localFile;

0 commit comments

Comments
 (0)