suggestion to standardize Iterate callback's arguments
See original GitHub issueWouldn’t it be better to standardize the callback in iterate with (value, index|key, target)
?
in iterate.js:
line 21
callback(target[i], i)
vs line 27 (Array.prorotype.forEach)
target.forEach(callback)
Also, if callback returns false break the loop.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Node.js: How do you handle callbacks in a loop?
Q: What is the best way in Node.js to 1) get the result of the first async call, 2) iterate through the list,...
Read more >The Good and Bad of JavaScript Callbacks - Bits and Pieces
The callback function — including its references — is passed as an argument to other functions. The functions that receive the callback function...
Read more >How to iterate over a callback n times in JavaScript
The callback is a function that is passed as an argument. for iterate ... Approach 1: We use recursion to iterate n times...
Read more >xgboost source: R/callbacks.R - Rdrr.io
When a callback function has \code{finalize} parameter, its finalizer part will ... The iteration evaluation result \code{bst_evaluation} must be a named ...
Read more >Mastering Hard Parts of JavaScript: Callbacks III
The callback will return either true or false. prioritize will iterate through the array and perform the callback on each element, and return...
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
Hello @Rayraegah. The difference between both lines you show is the target scope, no? But since this function is only used internally and is not exposed, why do we need the target scope?
I cannot break the loop if callback returns
false
. What iffalse
is actually a value you are iterating upon?When you add a new data-structure that would need this feature, then you can modify iterator 😃 otherwise its okay.