Fork
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { wholefoodssales } from "https://esm.town/v/Glench/wholefoodssales";
import { dataToRSS } from "https://esm.town/v/Glench/dataToRSS";
export const wholeFoodsRSS = async function (req, res: express.Response) {
res.send(
dataToRSS(await wholefoodssales(), {
title: "Whole Foods Sales — Personal",
link: "https://wholefoodsmarket.com",
item: {
title: (item) =>
`${item.brand} - ${item.name} - $${
item.incrementalSalePrice || item.salePrice
} ($${item.regularPrice})`,
description: (item) =>
`${item.store === 10091 ? "bellingham" : "dedham"}, ${
item.saleStartDate
}-${item.saleEndDate}`,
link: (item) =>
`https://www.wholefoodsmarket.com/product/${item.slug}?start=${item.saleStartDate}&store=${item.store}`,
pubDate: (item) => item.saleStartDate,
},
})
);
};
/*"regularPrice": 5.69,
"salePrice": 4.19,
"incrementalSalePrice": 3.77,
"saleStartDate": "2023-03-01T00:00:00Z",
"saleEndDate": "2023-04-04T23:59:59Z",
"name": "Fairtrade Baby Hemp Unscented Soap Bar, 5 oz",
"slug": "dr-bronners-fairtrade-baby-hemp-unscented-soap-bar-5-oz-b008588sm6",
"brand": "Dr. Bronner's",
"imageThumbnail": "https://m.media-amazon.com/images/S/assets.wholefoodsmarket.com/PIE/product/6351e34e671f8460db2d6d4b_0018787782057-glamor-front-2022-09-20t17-55-13-iphone-x-quality-90-1-32-2-user-5984ad42a967f880524de2c4-hoqo-666183.jpg",
"store": 10091,
"isLocal": false*/
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.