@metascraper/helpers 5.45.25 → 5.46.0-beta.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.
Files changed (2) hide show
  1. package/index.js +8 -2
  2. package/package.json +9 -9
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict'
2
2
 
3
3
  const memoizeOne = require('memoize-one').default || require('memoize-one')
4
+ const debug = require('debug-logfmt')('metascraper:find-rule')
4
5
  const condenseWhitespace = require('condense-whitespace')
5
6
  const { getExtension: mimeExtension } = require('mime')
6
7
  const capitalize = require('microsoft-capitalize')
@@ -420,14 +421,18 @@ const validator = {
420
421
 
421
422
  const truthyTest = () => true
422
423
 
423
- const findRule = async (rules, args) => {
424
+ const findRule = async (rules, args, propName) => {
424
425
  let index = 0
425
426
  let value
426
427
 
427
428
  do {
428
429
  const rule = rules[index++]
429
430
  const test = rule.test || truthyTest
430
- if (test(args)) value = await rule(args)
431
+ if (test(args)) {
432
+ const duration = debug.duration()
433
+ value = await rule(args)
434
+ duration(`${rule.pkgName}:${propName}:${index - 1}:${has(value)}`)
435
+ }
431
436
  } while (!has(value) && index < rules.length)
432
437
 
433
438
  return value
@@ -520,6 +525,7 @@ module.exports = {
520
525
  isUrl,
521
526
  isVideoExtension,
522
527
  isVideoUrl,
528
+ iso6393,
523
529
  jsonld,
524
530
  lang,
525
531
  loadIframe,
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://github.com/microlinkhq/metascraper/packages/metascraper-helpers",
5
- "version": "5.45.25",
5
+ "version": "5.46.0-beta.0",
6
6
  "main": "index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -23,10 +23,10 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "audio-extensions": "0.0.0",
26
- "chrono-node": "~2.7.6",
26
+ "chrono-node": "~2.7.7",
27
27
  "condense-whitespace": "~2.0.0",
28
28
  "data-uri-utils": "~1.0.8",
29
- "entities": "~4.5.0",
29
+ "entities": "~6.0.0",
30
30
  "file-extension": "~4.0.5",
31
31
  "has-values": "~2.0.1",
32
32
  "image-extensions": "~1.1.0",
@@ -34,17 +34,17 @@
34
34
  "is-uri": "~1.2.6",
35
35
  "iso-639-3": "~2.2.0",
36
36
  "isostring": "0.0.1",
37
- "jsdom": "~24.1.0",
37
+ "jsdom": "~25.0.1",
38
38
  "lodash": "~4.17.21",
39
39
  "memoize-one": "~6.0.0",
40
40
  "microsoft-capitalize": "~1.0.5",
41
- "mime": "~3.0.0",
41
+ "mime": "3",
42
42
  "normalize-url": "~6.1.0",
43
- "re2": "~1.21.0",
43
+ "re2": "~1.21.4",
44
44
  "smartquotes": "~2.3.2",
45
- "tldts": "~6.1.24",
45
+ "tldts": "~6.1.70",
46
46
  "url-regex-safe": "~4.0.0",
47
- "video-extensions": "~1.2.0"
47
+ "video-extensions": "1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "ava": "5",
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "50363a681cb279e659c1b4ee6d30319d9d9c297f"
66
+ "gitHead": "3fc0da7c1c5c45d4f1b59e49eedd9e649c8e645c"
67
67
  }