@metascraper/helpers 5.37.1 → 5.39.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 +3 -6
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -115,8 +115,6 @@ const REGEX_LOCATION = /^[A-Z\s]+\s+[-—–]\s+/
|
|
|
115
115
|
|
|
116
116
|
const REGEX_TITLE_SEPARATOR = /^[^|\-/•—]+/
|
|
117
117
|
|
|
118
|
-
const TRUNCATE_MAX_LENGTH = 300
|
|
119
|
-
|
|
120
118
|
const AUTHOR_MAX_LENGTH = 128
|
|
121
119
|
|
|
122
120
|
const removeLocation = value => replace(value, REGEX_LOCATION, '')
|
|
@@ -253,7 +251,7 @@ const description = (value, opts) =>
|
|
|
253
251
|
|
|
254
252
|
const getDescription = (
|
|
255
253
|
str,
|
|
256
|
-
{ truncateLength =
|
|
254
|
+
{ truncateLength = Number.MAX_SAFE_INTEGER, ellipsis = '…', ...opts } = {}
|
|
257
255
|
) => {
|
|
258
256
|
let truncated = str.slice(0, truncateLength)
|
|
259
257
|
if (truncated.length < str.length) truncated = truncated.trim() + ellipsis
|
|
@@ -340,11 +338,10 @@ memoizeOne.EqualityUrlAndHtmlDom = (newArgs, oldArgs) =>
|
|
|
340
338
|
const jsonld = memoizeOne(
|
|
341
339
|
$ =>
|
|
342
340
|
$('script[type="application/ld+json"]')
|
|
343
|
-
.map(
|
|
341
|
+
.map((_, element) => {
|
|
344
342
|
try {
|
|
345
|
-
const el = $(
|
|
343
|
+
const el = $(element)
|
|
346
344
|
const json = JSON.parse($(el).contents().text())
|
|
347
|
-
|
|
348
345
|
const { '@graph': graph, ...props } = json
|
|
349
346
|
if (!graph) return json
|
|
350
347
|
return graph.map(item => ({ ...props, ...item }))
|
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.39.0",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "de153b080df454a7130d0ae34a0deac277b8df8b"
|
|
66
66
|
}
|