metascraper 5.46.11 → 5.46.13

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.d.ts +17 -4
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "metascraper",
3
3
  "description": "A library to easily scrape metadata from an article on the web using Open Graph, JSON+LD, regular HTML metadata, and series of fallbacks.",
4
4
  "homepage": "https://metascraper.js.org",
5
- "version": "5.46.11",
5
+ "version": "5.46.13",
6
6
  "types": "src/index.d.ts",
7
7
  "main": "src/index.js",
8
8
  "repository": {
@@ -86,5 +86,5 @@
86
86
  "tsd": {
87
87
  "directory": "test/types"
88
88
  },
89
- "gitHead": "12e55506648d4485be3bdee36334040610760257"
89
+ "gitHead": "4138964932d97c650cc1d10067696a0500eefbb7"
90
90
  }
package/src/index.d.ts CHANGED
@@ -95,9 +95,11 @@ declare namespace createMetascraper {
95
95
  [key: string]: string | undefined;
96
96
  }
97
97
 
98
- export type Rules = {
99
- [C in keyof Metadata]?: Array<RulesOptions> | RulesOptions;
100
- } & {
98
+ type NamedRules = {
99
+ [C in keyof Metadata as string extends C ? never : C]?: Array<RulesOptions> | RulesOptions;
100
+ };
101
+
102
+ export interface Rules extends NamedRules {
101
103
  /**
102
104
  * The test function to be executed for skipping rules that doesn't return `true`.
103
105
  */
@@ -106,7 +108,18 @@ declare namespace createMetascraper {
106
108
  * The package name associated with the rule, used for debugging purposes.
107
109
  */
108
110
  pkgName?: string;
109
- };
111
+ /**
112
+ * allow any other string key to be
113
+ * a rule-function (for ad-hoc metadata),
114
+ * or the two special keys above.
115
+ **/
116
+ [key: string]:
117
+ | Array<RulesOptions>
118
+ | RulesOptions
119
+ | ((options: RulesTestOptions) => boolean)
120
+ | string
121
+ | undefined;
122
+ }
110
123
 
111
124
  export type RulesOptions = (
112
125
  options: RulesTestOptions