@metascraper/helpers 5.54.0 → 5.54.1

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/package.json +2 -2
  2. package/src/index.js +3 -4
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@metascraper/helpers",
3
3
  "description": "Shared helper utilities used across metascraper rules for parsing and normalizing metadata.",
4
4
  "homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-helpers",
5
- "version": "5.54.0",
5
+ "version": "5.54.1",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "hello@microlink.io",
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "23db3208c1dcc6367a705bdb9bf723fbaae259e0"
76
+ "gitHead": "9f72883982e1c5486f2b3dbc6fa4d7958885e518"
77
77
  }
package/src/index.js CHANGED
@@ -548,12 +548,11 @@ const validator = {
548
548
 
549
549
  const truthyTest = () => true
550
550
 
551
- const isValidValue = async (rule, value, args) => {
551
+ const isValidValue = async (value, args) => {
552
552
  try {
553
- return await rule.validate(value, args, debug)
553
+ return await args.validate(value, args, debug)
554
554
  } catch (error) {
555
555
  debug('validate:error', {
556
- pkgName: rule.pkgName,
557
556
  errorName: error?.name,
558
557
  errorMessage: error?.message
559
558
  })
@@ -574,7 +573,7 @@ const findRule = async (rules, args = {}, propName) => {
574
573
  value = await rule(args)
575
574
  hasValue = has(value)
576
575
  const isRejected =
577
- hasValue && rule.validate && !(await isValidValue(rule, value, args))
576
+ hasValue && args.validate && !(await isValidValue(value, args))
578
577
  if (isRejected) {
579
578
  value = undefined
580
579
  hasValue = false