New Merge function.
See original GitHub issueI noticed you’ve changed how the merge function works. You now use an array instead of an object:
var target = []
Then when you use it, you also use a for in loop:
for (var i in merge(lastValue, nextValue))
For in loops with arrays are notorious for various unexpected issues and are known for not being very performant compared to alternative means of looping Stackoverflow, The Problems with for…in and JavaScript Arrays. I’d suggest using map
instead. It’s more performant, easier to read and doesn’t suffer from issues that for of can cause:
merge(lastValue, nextValue).map(nextValue => {
var style = nextValue == null || nextValue[i] == null ? "" : nextValue[I]
//...
})
This is just a friendly suggestion, not an OMG we gotsa have it!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (7 by maintainers)
Top Results From Across the Web
MERGE Function - Trifacta Documentation
Merges two or more columns of String type to generate output of String type. Optionally, you can insert a delimiter between the merged...
Read more >Merge and unmerge cells - Microsoft Support
How to merge and unmerge cells (text or data) in Excel from two or more cells into one cell. ... Excel keyboard shortcuts...
Read more >How to use the merge() function for data frames in R
The merge() function in R combines two data frames. The most crucial requirement for connecting two data frames is that the column type...
Read more >merge - Functions - Configuration Language | Terraform
The merge function takes an arbitrary number maps or objects, and returns a single map or object that contains a merged set of...
Read more >Writing A Merge Function For My Data-Frames Package
I am simply going to add some dispatch functions for a new function called merge!(). You might notice that here merge!() has an...
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 Free
Top 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
See, that’s the whole thing about JSPerf. It makes it really easy to put together misleading tests. One thing, if you are going to use JSPerf to determine an architectural direction, you really need to test on as many browsers as possible: IE11, MSEdge, Firefox, Chrome and Safari. Browsers optimize different things, resulting in sometimes wildly different results for the same perf.
A new version is out! Thanks, @rbiggs, for discovering my mistake.