Last active
March 3, 2021 23:56
-
-
Save nickcaballero/dbf52dea7b549a588e50c3500483d694 to your computer and use it in GitHub Desktop.
Babylist sum of registry items
This file contains hidden or 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
// Run this in console | |
[...document.querySelectorAll('.mtm')] | |
.map(group => [...group.querySelectorAll('.offer-price')] | |
.map(element => parseFloat(element.textContent.substring(1))) | |
.reduce((agg, value, i) => (agg + value) / (i ? 2 : 1), 0)) // Take average when product is available on multiple sites | |
.reduce((sum, value) => sum + value, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment