metascraper 5.58.5 → 5.58.6
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.
- package/package.json +2 -2
- package/src/get-data.js +8 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "metascraper",
|
|
3
3
|
"description": "Scrape metadata from any URL using Open Graph, JSON-LD, HTML meta tags, and smart fallbacks.",
|
|
4
4
|
"homepage": "https://metascraper.js.org",
|
|
5
|
-
"version": "5.58.
|
|
5
|
+
"version": "5.58.6",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
7
7
|
"main": "src/index.js",
|
|
8
8
|
"repository": {
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"tsd": {
|
|
56
56
|
"directory": "test/types"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "1a98097c1878ced8ef6a07913a9b988370d8a0e7"
|
|
59
59
|
}
|
package/src/get-data.js
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
const debug = require('debug-logfmt')('metascraper:get-data')
|
|
4
4
|
const { findRule, has } = require('@metascraper/helpers')
|
|
5
5
|
|
|
6
|
+
const PRINTABLE_TYPES = new Set(['string', 'number', 'boolean', 'bigint'])
|
|
7
|
+
|
|
8
|
+
const formatValue = value =>
|
|
9
|
+
value === null || PRINTABLE_TYPES.has(typeof value) ? value : typeof value
|
|
10
|
+
|
|
6
11
|
const getData = async ({ rules, ...props }) => {
|
|
7
12
|
const data = {}
|
|
8
13
|
|
|
@@ -26,7 +31,9 @@ const getData = async ({ rules, ...props }) => {
|
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
duration(
|
|
29
|
-
`${propName}=${normalizedValue} rules=${
|
|
34
|
+
`${propName}=${formatValue(normalizedValue)} rules=${
|
|
35
|
+
innerRules.length
|
|
36
|
+
} status=${status}`
|
|
30
37
|
)
|
|
31
38
|
data[propName] = normalizedValue
|
|
32
39
|
})
|