-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix agg metrics, don't use "for .. in .." on JS arrays
Agg metrics were broken because we iterated over an array using "for .. in ..", which has unexpected consequences. "for .. in .." iterates over all the keys in an object. Arrays are a type of object, where the elements of the array are keyed by index. But they can have other properties too (like their methods) so when you use "for .. in .." you get everything. In general arrays should be iterated with "for .. of .." or ".forEach", but in this specific case I noticed we are basically just copying an array with some values substituted, so I opted for ".map". Note: There is repeated code across these two files that should obviously be refactored later, but for now I just want to get this bug fixed.
- Loading branch information
Showing
2 changed files
with
12 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters