question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New Merge function.

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rbiggscommented, Jul 3, 2018

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.

0reactions
jorgebucarancommented, Jul 7, 2018

A new version is out! Thanks, @rbiggs, for discovering my mistake.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found