-
-
Save AnderRV/ca79d4886cd10dfd4b9719bee26e62ac to your computer and use it in GitHub Desktop.
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
const extractContent = $ => | |
$('.product') | |
.map((_, product) => { | |
const $product = $(product); | |
return { | |
id: $product.find('a[data-product_id]').attr('data-product_id'), | |
title: $product.find('h2').text(), | |
price: $product.find('.price').text(), | |
}; | |
}) | |
.toArray(); | |
// ... | |
const content = extractContent($); | |
console.log(content); | |
// [{ id: '759', title: 'Bulbasaur', price: '£63.00' }, ...] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment