Skip to content

Commit d97805d

Browse files
committed
Remove Law of Demeter
1 parent cd50889 commit d97805d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -1444,13 +1444,11 @@ class Human extends Mammal {
14441444

14451445

14461446
### Use method chaining
1447-
Against the advice of Clean Code, this is one place where we will have to differ.
1448-
It has been argued that method chaining is unclean and violates the [Law of Demeter](https://en.wikipedia.org/wiki/Law_of_Demeter).
1449-
Maybe it's true, but this pattern is very useful in JavaScript and you see it in
1450-
many libraries such as jQuery and Lodash. It allows your code to be expressive,
1451-
and less verbose. For that reason, I say, use method chaining and take a look at
1452-
how clean your code will be. In your class functions, simply return `this` at
1453-
the end of every function, and you can chain further class methods onto it.
1447+
This pattern is very useful in JavaScript and you see it in many libraries such
1448+
as jQuery and Lodash. It allows your code to be expressive, and less verbose.
1449+
For that reason, I say, use method chaining and take a look at how clean your code
1450+
will be. In your class functions, simply return `this` at the end of every function,
1451+
and you can chain further class methods onto it.
14541452

14551453
**Bad:**
14561454
```javascript

0 commit comments

Comments
 (0)