Method chaining when using `update`
See original GitHub issueIs your feature request related to a problem? Please describe. Method chaining can help simplify code.
Describe the solution you’d like I have a code block like this:
const hash256 = (str) => {
const shaObj = new jsSHA('SHA-256', 'TEXT');
shaObj.update(str);
return shaObj.getHash('HEX');
}
I thought I could simplify it like this:
const hash256 = (str) => new jsSHA('SHA-256', 'TEXT').update(str).getHash('HEX');
But it won’t be possible since update
returns void
and not this
.
Perhaps it could return this
so that chaining becomes possible.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Method Chaining In Java with Examples - GeeksforGeeks
Method chaining in Java is a common syntax to invoke multiple methods calls in OOPs. Each method in chaining returns an object.
Read more >Method chaining - why is it a good practice, or not?
IMO, the best way to use method chaining in this scenario is to create a parameter object to be passed to the function,...
Read more >JavaScript Function Chaining - Medium
Function chaining is a pattern in JavaScript where multiple functions are called on the same object consecutively. Using the same object reference, ...
Read more >The Unreasonable Effectiveness of Method Chaining in Pandas
One obvious advantage of Method chaining is that it is a top-down approach with arguments placed next to the function unlike the nested...
Read more >Method Chaining in JavaScript - Tutorialspoint
In method chaining, we call separate methods of a single object like a chain without assigning the same object multiple times by assignment ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just released v3.3.0!
I got lazy and squelched the problematic eslint options 😃
This should be now implemented in 2c60363