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.

Strange "empty-function-body into broken-array" mutation?

See original GitHub issue

image

This looks like it wants to mutate

angular.module('juiceShop').controller('AboutController', [
  function () {}])

into

angular.module('juiceShop').controller('AboutController', [
  function () { })

which doesn’t seem like a good idea, syntax-wise with that missing closing angular bracket… or maybe it’s just rendered wrong in the HTML report?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
bkimminichcommented, Oct 1, 2016

I did remove the ‘use strict’ because I thought that triggered the mutation. But it still mutated the empty block.

I would just ignore empty blocks, if anything other than statements (even comments!) is in a block, it should mutate. This kind of brought the useless ‘use strict’ with no subsequent code to my attention.

0reactions
bkimminichcommented, Oct 6, 2016

Fine for me. Plese ping me when I should re-test this!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Washing your code: avoid mutation - Artem Sapegin
Mutations happen when we change a JavaScript object or array without creating a new variable or reassigning an existing one.
Read more >
Having Trouble Understanding Empty Initializer in Reduce ...
The empty object is the initial value of the accumulator, which gets a property assigned to it on each iteration. The object does...
Read more >
Discuss Remove the minimum - Codewars
I used python to solve the problem. I have not mutated the input array, but one testcase tells me that I have mutated...
Read more >
Mutation, Repair and Recombination - Genomes - NCBI - NIH
Some mutations are spontaneous errors in replication that evade the proofreading function of the DNA polymerases that synthesize new polynucleotides at the ...
Read more >
Arrays, Objects and Mutations - Medium
Here are some thoughts on how to avoid mutations when working with arrays and objects in JavaScript by treating them as if they...
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