@metascraper/helpers 5.26.0 → 5.29.0
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/index.js +11 -5
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -8,11 +8,11 @@ const {
|
|
|
8
8
|
includes,
|
|
9
9
|
invoke,
|
|
10
10
|
isArray,
|
|
11
|
+
isBoolean,
|
|
12
|
+
isDate,
|
|
11
13
|
isEmpty,
|
|
12
14
|
isNumber,
|
|
13
|
-
isBoolean,
|
|
14
15
|
isString,
|
|
15
|
-
isDate,
|
|
16
16
|
lte,
|
|
17
17
|
replace,
|
|
18
18
|
size,
|
|
@@ -121,6 +121,7 @@ const sanetizeUrl = (url, opts) =>
|
|
|
121
121
|
_normalizeUrl(url, {
|
|
122
122
|
stripWWW: false,
|
|
123
123
|
sortQueryParameters: false,
|
|
124
|
+
removeSingleSlash: false,
|
|
124
125
|
removeTrailingSlash: false,
|
|
125
126
|
...opts
|
|
126
127
|
})
|
|
@@ -298,13 +299,18 @@ memoizeOne.EqualityUrlAndHtmlDom = (newArgs, oldArgs) =>
|
|
|
298
299
|
const jsonld = memoizeOne(
|
|
299
300
|
$ =>
|
|
300
301
|
$('script[type="application/ld+json"]')
|
|
301
|
-
.map((
|
|
302
|
+
.map(function () {
|
|
302
303
|
try {
|
|
303
|
-
|
|
304
|
-
|
|
304
|
+
const el = $(this)
|
|
305
|
+
const json = JSON.parse(
|
|
306
|
+
$(el)
|
|
305
307
|
.contents()
|
|
306
308
|
.text()
|
|
307
309
|
)
|
|
310
|
+
|
|
311
|
+
const { '@graph': graph, ...props } = json
|
|
312
|
+
if (!graph) return json
|
|
313
|
+
return graph.map(item => ({ ...props, ...item }))
|
|
308
314
|
} catch (_) {
|
|
309
315
|
return undefined
|
|
310
316
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@metascraper/helpers",
|
|
3
3
|
"description": "Collection of helper functions used by metascraper",
|
|
4
4
|
"homepage": "https://nicedoc.io/microlinkhq/metascraper/packages/metascraper-helpers",
|
|
5
|
-
"version": "5.
|
|
5
|
+
"version": "5.29.0",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"audio-extensions": "0.0.0",
|
|
26
26
|
"chrono-node": "2.3.8",
|
|
27
27
|
"condense-whitespace": "~2.0.0",
|
|
28
|
-
"entities": "~
|
|
28
|
+
"entities": "~4.1.1",
|
|
29
29
|
"file-extension": "~4.0.5",
|
|
30
30
|
"has-values": "~2.0.1",
|
|
31
31
|
"image-extensions": "~1.1.0",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "86572d38b9d5de0af1608d1516756cc3ed5a43af"
|
|
67
67
|
}
|