metascraper-manifest 5.28.2 → 5.28.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +11 -4
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const { normalizeUrl, logo, composeRule } = require('@metascraper/helpers')
4
4
  const asyncMemoizeOne = require('async-memoize-one')
5
- const { get, first, orderBy } = require('lodash')
5
+ const { chain, toLower } = require('lodash')
6
6
  const memoize = require('@keyvhq/memoize')
7
7
  const got = require('got')
8
8
 
@@ -41,9 +41,16 @@ module.exports = opts => {
41
41
  publisher: manifest({ from: 'short_name', to: 'publisher' }),
42
42
  logo: async ({ htmlDom, url }) => {
43
43
  const manifest = await toManifest(htmlDom, url)
44
- const icons = get(manifest, 'icons')
45
- const icon = first(orderBy(icons, 'sizes', 'desc')) || {}
46
- return logo(icon.src, { url })
44
+
45
+ const iconSrc = chain(manifest)
46
+ .get('icons')
47
+ .filter(icon => toLower(icon.purpose) !== 'monochrome')
48
+ .orderBy('sizes', 'desc')
49
+ .first()
50
+ .get('src')
51
+ .value()
52
+
53
+ return logo(iconSrc, { url })
47
54
  }
48
55
  }
49
56
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "metascraper-manifest",
3
3
  "description": "Metascraper integration for derecting PWA Web app manifest",
4
4
  "homepage": "https://nicedoc.io/microlinkhq/metascraper/packages/metascraper-manifest",
5
- "version": "5.28.2",
5
+ "version": "5.28.4",
6
6
  "main": "index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -51,5 +51,5 @@
51
51
  "slow": 300,
52
52
  "timeout": "120000"
53
53
  },
54
- "gitHead": "373d7f2b46ca3d1f163c412c1735daaf9434568d"
54
+ "gitHead": "a318787e77663096e359869148b0810481d84cd6"
55
55
  }