![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Library to (not so) randomly pick beers for you.
This library works with a list of beers from the metro online grocery website that you can extract using feed-me.
const metro = require('feed-me')
const fs = require('fs')
metro.getAllResults({ category: 'beverages/beer-cider' })
.then(JSON.stringify)
.then(json => fs.writeFileSync('beers.json', json))
The expected format of a beer object is the following:
{
"brand": "Brasserie Dieu du Ciel!",
"name": "Disco Soleil kumquats IPA strong beer",
"weight": "341 ml - bottle",
"price": 2.39,
"image": {
"small": "https://product-images.metro.ca/images/h0b/h4c/8883933675550.jpg",
"large": "https://product-images.metro.ca/images/h41/h2e/8883934593054.jpg"
},
"link": "https://www.metro.ca/en/online-grocery/aisles/beverages/beer-cider/artisanal-beer-microbrewery/disco-soleil-kumquats-ipa-strong-beer/p/696859060489",
"category": "beverages/beer-cider/artisanal-beer-microbrewery"
}
For convenience, I added a static version of that list in the
beers
branch.
const beer = require('beer-me')
const beers = require('./beers').map(beer.formatify)
console.log(beer.beerMe(beers, 48))
You will get a selection of beers in the same format, but with a number of items that will match the desired number of beers (given as second argument).
For some reason, even if you search in the beverages/beer-cider
categories, you get, stuff that is definitely not beer:
beverages/beer-cider/cider
beverages/beer-cider/non-alcoholic-beer
beverages/juices-drinks/sparkling-juices-drinks
beverages/soft-drinks/ginger-ale
beverages/wines-cocktails-coolers/cocktails-other-wines
beverages/wines-cocktails-coolers/sparkling-wine
By calling:
const actualBeers = beers.filter(beer.isActualBeer)
You get only beers from the following categories:
beverages/beer-cider/artisanal-beer-microbrewery
beverages/beer-cider/classic-beer
beverages/beer-cider/classic-light-beer
beverages/beer-cider/imported-beer
beverages/beer-cider/specialty-flavoured-beer
beer.parseFormat('740•ml - can') // { count: 1, size: 740, type: 'can' }
beer.parseFormat('24x330•ml - cans') // { count: 24, size: 330, type: 'cans' }
beer.parseFormat('1.18•L - bottle') // { count: 1, size: 1180, type: 'bottle' }
beer.parseFormat('12x341•ml - bottles') // { count: 12, size: 341, type: 'bottles' }
You can also use the following:
const parsedBeers = beers.map(beer.formatify)
After what all the beers will have a format
property with the count
,
size
and type
.
This is especially useful to filter beers:
const packsOfCans = parsedBeers.filter(beer => beer.format.type === 'cans')
const packsOfBottles = parsedBeers.filter(beer => beer.format.type === 'bottles')
const bigPacksOfBottles = packsOfBottles.filter(beer => beer.format.count >= 24)
This is also needed for the beerMe
algorithm.
Get packs of between 12 and 24 bottles (less than 500 ml) of beer from a given list of brands, to get a total of 48 bottles:
const beer = require('beer-me')
const beers = require('./beers')
const brands = require('./brands') // An array of brand names to pick.
const set = beers
.map(beer.formatify)
.filter(beer.isActualBeer)
.filter(beer => beer.format.type === 'bottles')
.filter(beer => beer.format.count >= 12 && beer.format.count <= 24)
.filter(beer => beer.format.size < 500)
.filter(beer => brands.includes(beer.brand))
const selection = beer.beerMe(set, 48)
FAQs
Library to (not so) randomly pick beers for you.
The npm package beer-me receives a total of 4 weekly downloads. As such, beer-me popularity was classified as not popular.
We found that beer-me demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.