@metascraper/helpers 5.54.1 → 5.55.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/package.json +2 -2
  2. package/src/index.js +2 -1
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.1",
5
+ "version": "5.55.0",
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": "9f72883982e1c5486f2b3dbc6fa4d7958885e518"
76
+ "gitHead": "c6fdffea348dcee4ff5ce22613518c4c68f50f2a"
77
77
  }
package/src/index.js CHANGED
@@ -564,6 +564,7 @@ const findRule = async (rules, args = {}, propName) => {
564
564
  let index = 0
565
565
  let value
566
566
  let hasValue = false
567
+ const validateArgs = args.validate ? { ...args, propName } : args
567
568
 
568
569
  do {
569
570
  const rule = rules[index++]
@@ -573,7 +574,7 @@ const findRule = async (rules, args = {}, propName) => {
573
574
  value = await rule(args)
574
575
  hasValue = has(value)
575
576
  const isRejected =
576
- hasValue && args.validate && !(await isValidValue(value, args))
577
+ hasValue && args.validate && !(await isValidValue(value, validateArgs))
577
578
  if (isRejected) {
578
579
  value = undefined
579
580
  hasValue = false