@metascraper/helpers 5.29.10 → 5.29.14

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 +6 -4
  2. package/package.json +4 -4
package/index.js CHANGED
@@ -31,7 +31,7 @@ const _normalizeUrl = require('normalize-url')
31
31
  const smartquotes = require('smartquotes')
32
32
  const { decodeHTML } = require('entities')
33
33
  const iso6393 = require('iso-639-3/to-1')
34
- const mimeTypes = require('mime-types')
34
+ const { getExtension } = require('mime')
35
35
  const hasValues = require('has-values')
36
36
  const chrono = require('chrono-node')
37
37
  const isIso = require('isostring')
@@ -237,7 +237,7 @@ const author = (value, opts) =>
237
237
  isAuthor(value) ? getAuthor(value, opts) : undefined
238
238
 
239
239
  const url = (value, { url = '' } = {}) => {
240
- if (isEmpty(value)) return
240
+ if (!isString(value) || isEmpty(value)) return
241
241
 
242
242
  try {
243
243
  const absoluteUrl = normalizeUrl(url, value)
@@ -299,7 +299,7 @@ const title = (value, { removeSeparator = false, ...opts } = {}) =>
299
299
  isString(value) ? titleize(value, { removeSeparator, ...opts }) : undefined
300
300
 
301
301
  const isMime = (contentType, type) => {
302
- const ext = mimeTypes.extension(contentType)
302
+ const ext = getExtension(contentType)
303
303
  return eq(type, get(EXTENSIONS, ext))
304
304
  }
305
305
 
@@ -344,7 +344,9 @@ const $jsonld = propName => $ => {
344
344
 
345
345
  const image = (value, opts) => {
346
346
  const urlValue = url(value, opts)
347
- return !isAudioUrl(urlValue, opts) && !isVideoUrl(urlValue, opts)
347
+ return urlValue !== undefined &&
348
+ !isAudioUrl(urlValue, opts) &&
349
+ !isVideoUrl(urlValue, opts)
348
350
  ? urlValue
349
351
  : undefined
350
352
  }
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.29.10",
5
+ "version": "5.29.14",
6
6
  "main": "index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -33,11 +33,11 @@
33
33
  "is-uri": "~1.2.4",
34
34
  "iso-639-3": "~2.2.0",
35
35
  "isostring": "0.0.1",
36
- "jsdom": "~19.0.0",
36
+ "jsdom": "~20.0.0",
37
37
  "lodash": "~4.17.21",
38
38
  "memoize-one": "~6.0.0",
39
39
  "microsoft-capitalize": "~1.0.5",
40
- "mime-types": "~2.1.35",
40
+ "mime": "~3.0.0",
41
41
  "normalize-url": "~6.1.0",
42
42
  "re2": "~1.17.7",
43
43
  "smartquotes": "~2.3.2",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "1caeb9ed3cb6255b7f730a66f558b06715be94df"
64
+ "gitHead": "ca48314be69ff7ac72ffe2d191df0786a34e2d99"
65
65
  }