booru 2.6.9 → 2.7.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 (49) hide show
  1. package/dist/Constants.d.ts +6 -5
  2. package/dist/Constants.d.ts.map +1 -0
  3. package/dist/Constants.js +5 -6
  4. package/dist/Constants.js.map +1 -1
  5. package/dist/Utils.d.ts +2 -1
  6. package/dist/Utils.d.ts.map +1 -0
  7. package/dist/Utils.js +11 -15
  8. package/dist/Utils.js.map +1 -1
  9. package/dist/boorus/Booru.d.ts +5 -4
  10. package/dist/boorus/Booru.d.ts.map +1 -0
  11. package/dist/boorus/Booru.js +30 -34
  12. package/dist/boorus/Booru.js.map +1 -1
  13. package/dist/boorus/Derpibooru.d.ts +4 -10
  14. package/dist/boorus/Derpibooru.d.ts.map +1 -0
  15. package/dist/boorus/Derpibooru.js +0 -8
  16. package/dist/boorus/Derpibooru.js.map +1 -1
  17. package/dist/boorus/XmlBooru.d.ts +2 -8
  18. package/dist/boorus/XmlBooru.d.ts.map +1 -0
  19. package/dist/boorus/XmlBooru.js +0 -8
  20. package/dist/boorus/XmlBooru.js.map +1 -1
  21. package/dist/index.d.ts +3 -2
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +4 -5
  24. package/dist/index.js.map +1 -1
  25. package/dist/sites.json +219 -1
  26. package/dist/structures/InternalSearchParameters.d.ts +2 -1
  27. package/dist/structures/InternalSearchParameters.d.ts.map +1 -0
  28. package/dist/structures/InternalSearchParameters.js.map +1 -1
  29. package/dist/structures/Post.d.ts +2 -1
  30. package/dist/structures/Post.d.ts.map +1 -0
  31. package/dist/structures/Post.js +46 -44
  32. package/dist/structures/Post.js.map +1 -1
  33. package/dist/structures/SearchParameters.d.ts +5 -4
  34. package/dist/structures/SearchParameters.d.ts.map +1 -0
  35. package/dist/structures/SearchParameters.js.map +1 -1
  36. package/dist/structures/SearchResults.d.ts +4 -3
  37. package/dist/structures/SearchResults.d.ts.map +1 -0
  38. package/dist/structures/SearchResults.js +20 -12
  39. package/dist/structures/SearchResults.js.map +1 -1
  40. package/dist/structures/Site.d.ts +3 -2
  41. package/dist/structures/Site.d.ts.map +1 -0
  42. package/dist/structures/Site.js.map +1 -1
  43. package/dist/structures/SiteApi.d.ts +1 -0
  44. package/dist/structures/SiteApi.d.ts.map +1 -0
  45. package/dist/structures/SiteApi.js.map +1 -1
  46. package/dist/structures/SiteInfo.d.ts +2 -1
  47. package/dist/structures/SiteInfo.d.ts.map +1 -0
  48. package/dist/structures/SiteInfo.js.map +1 -1
  49. package/package.json +11 -27
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAuDsB,+BAAO;AAsBhC,wBAgCC;AAiBD,4BAGC;AA/HD,2CAAwD;AAExD,+BAAgC;AAChC,2DAAwD;AACxD,qEAA4C;AAgInC,qBAhIF,oBAAU,CAgIE;AA/HnB,iEAAwC;AA+HQ,mBA/HzC,kBAAQ,CA+HyC;AA9HxD,6DAAoC;AA8Hf,eA9Hd,cAAI,CA8Hc;AA5HzB,+EAAsD;AA4H3B,wBA5HpB,uBAAa,CA4HoB;AA3HxC,6DAAoC;AA2HM,eA3HnC,cAAI,CA2HmC;AA1H9C,mCAAqC;AAErC,MAAM,UAAU,GAAiC;IAC/C,KAAK,EAAE,oBAAU;IACjB,GAAG,EAAE,kBAAQ;CACd,CAAA;AAED,MAAM,UAAU,GAAoC,EAAE,CAAA;AAEtD;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,SAAe,EAAE,WAA8B;IAChE,OAAO,IAAI,CACT,SAAS,CAAC,IAAI,KAAK,SAAS,IAAI,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC;QACxD,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC;QAC5B,CAAC,CAAC,eAAK,CACV,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;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ocumentation\n * @module Index\n */\n\nimport { type AnySite, BooruError, sites } from './Constants'\n\nimport { deprecate } from 'node:util'\nimport { resolveSite } from './Utils'\nimport Booru, { type BooruCredentials } from './boorus/Booru'\nimport Derpibooru from './boorus/Derpibooru'\nimport XmlBooru from './boorus/XmlBooru'\nimport Post from './structures/Post'\nimport type SearchParameters from './structures/SearchParameters'\nimport SearchResults from './structures/SearchResults'\nimport Site from './structures/Site'\n\nconst BooruTypes: Record<string, typeof Booru> = {\n derpi: Derpibooru,\n xml: XmlBooru,\n}\n\nconst booruCache: Partial<Record<AnySite, Booru>> = {}\n\n/**\n * Create a new booru, if special type, use that booru, else use default Booru\n *\n * @param booruSite The site to use\n * @param credentials The credentials to use, if any\n * @return A new booru\n */\nfunction booruFrom(booruSite: Site, credentials?: BooruCredentials): Booru {\n return new (\n booruSite.type !== undefined && BooruTypes[booruSite.type]\n ? BooruTypes[booruSite.type]\n : Booru\n )(booruSite, credentials)\n}\n\n/**\n * Create a new booru to search with\n *\n * @constructor\n * @param {String} site The {@link Site} domain (or alias of it) to create a booru from\n * @param {BooruCredentials} credentials The credentials to use on this booru\n * @return {Booru} A booru to use\n */\nfunction booruForSite(site: string, credentials?: BooruCredentials): Booru {\n const rSite = resolveSite(site)\n\n if (!rSite) throw new BooruError('Site not supported')\n\n const booruSite = new Site(sites[rSite])\n\n // If special type, use that booru, else use default Booru\n return booruFrom(booruSite, credentials)\n}\n\nexport { booruForSite as forSite }\nexport default booruForSite\n\nexport interface BooruSearch extends SearchParameters {\n credentials?: BooruCredentials\n}\n\n/**\n * Searches a site for images with tags and returns the results\n * @param {String} site The site to search\n * @param {String[]|String} [tags=[]] Tags to search with\n * @param {SearchParameters} [searchOptions={}] The options for searching\n * if provided (Unused)\n * @return {Promise<SearchResults>} A promise with the images as an array of objects\n *\n * @example\n * ```\n * const Booru = require('booru')\n * // Returns a promise with the latest cute glace pic from e926\n * Booru.search('e926', ['glaceon', 'cute'])\n * ```\n */\nexport function search(\n site: string,\n tags: string[] | string = [],\n { limit = 1, random = false, page = 0, credentials = {} }: BooruSearch = {},\n): Promise<SearchResults> {\n const rSite = resolveSite(site)\n\n if (typeof limit === 'string') {\n limit = Number.parseInt(limit, 10)\n }\n\n if (rSite === null) {\n throw new BooruError('Site not supported')\n }\n\n if (!Array.isArray(tags) && typeof tags !== 'string') {\n throw new BooruError('`tags` should be an array or string')\n }\n\n if (typeof limit !== 'number' || Number.isNaN(limit)) {\n throw new BooruError('`limit` should be an int')\n }\n\n const booruSite = new Site(sites[rSite])\n\n if (!booruCache[rSite]) {\n booruCache[rSite] = booruFrom(booruSite, credentials)\n }\n\n // This is ugly and a hack, I know this\n booruCache[rSite].credentials = credentials\n return booruCache[rSite].search(tags, { limit, random, page })\n}\n\nconst deprecatedCommonfy = deprecate(\n () => {},\n 'Common is now deprecated, just access the properties directly',\n)\n\n/**\n * Deprecated, now a noop\n * <p>This will be removed *soon* please stop using it</p>\n * <p>Just access <code>&lt;{@link Post}&gt;.prop</code>, no need to commonfy anymore\n *\n * @deprecated Just use <code>&lt;{@link Post}&gt;.prop</code> instead\n * @param {Post[]} images Array of {@link Post} objects\n * @return {Promise<Post[]>} Array of {@link Post} objects\n */\nexport function commonfy(images: Post[]): Promise<Post[]> {\n deprecatedCommonfy()\n return Promise.resolve(images)\n}\n\nexport { Booru as BooruClass } from './boorus/Booru'\nexport { BooruError, sites } from './Constants'\nexport { resolveSite } from './Utils'\nexport { Derpibooru, Post, SearchResults, Site, XmlBooru }\nexport type { BooruCredentials, SearchParameters }\n"]}
package/dist/sites.json CHANGED
@@ -1 +1,219 @@
1
- {"e621.net":{"domain":"e621.net","aliases":["e6","e621"],"nsfw":true,"api":{"search":"/posts.json?","postView":"/post/show/"},"random":true},"e926.net":{"domain":"e926.net","aliases":["e9","e926"],"nsfw":false,"api":{"search":"/posts.json?","postView":"/post/show/"},"random":true,"defaultTags":["rating:safe"]},"hypnohub.net":{"domain":"hypnohub.net","aliases":["hh","hypno","hypnohub"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/post/show/"},"paginate":"pid","random":false},"danbooru.donmai.us":{"domain":"danbooru.donmai.us","aliases":["db","dan","danbooru"],"nsfw":true,"api":{"search":"/posts.json?","postView":"/posts/"},"random":true},"konachan.com":{"domain":"konachan.com","aliases":["kc","konac","kcom"],"nsfw":true,"api":{"search":"/post.json?","postView":"/post/show/"},"random":true},"konachan.net":{"domain":"konachan.net","aliases":["kn","konan","knet"],"nsfw":false,"api":{"search":"/post.json?","postView":"/post/show/"},"random":true},"yande.re":{"domain":"yande.re","aliases":["yd","yand","yandere"],"nsfw":true,"api":{"search":"/post.json?","postView":"/post/show/"},"random":true},"gelbooru.com":{"domain":"gelbooru.com","aliases":["gb","gel","gelbooru"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"rule34.xxx":{"domain":"api.rule34.xxx","aliases":["r34","rule34"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"safebooru.org":{"domain":"safebooru.org","aliases":["sb","safe","safebooru"],"nsfw":false,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"tbib.org":{"domain":"tbib.org","aliases":["tb","tbib","big"],"nsfw":false,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"xbooru.com":{"domain":"xbooru.com","aliases":["xb","xbooru"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"rule34.paheal.net":{"domain":"rule34.paheal.net","type":"xml","aliases":["pa","paheal"],"nsfw":true,"api":{"search":"/api/danbooru/find_posts?","postView":"/post/view/"},"random":false},"derpibooru.org":{"domain":"derpibooru.org","type":"derpi","aliases":["dp","derp","derpi","derpibooru"],"nsfw":true,"api":{"search":"/api/v1/json/search/images?","postView":"/images/"},"tagQuery":"q","tagJoin":",","random":"sf=random"},"realbooru.com":{"domain":"realbooru.com","aliases":["rb","realbooru"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&id="},"paginate":"pid","random":false}}
1
+ {
2
+ "e621.net": {
3
+ "domain": "e621.net",
4
+ "aliases": [
5
+ "e6",
6
+ "e621"
7
+ ],
8
+ "nsfw": true,
9
+ "api": {
10
+ "search": "/posts.json?",
11
+ "postView": "/post/show/"
12
+ },
13
+ "random": true
14
+ },
15
+ "e926.net": {
16
+ "domain": "e926.net",
17
+ "aliases": [
18
+ "e9",
19
+ "e926"
20
+ ],
21
+ "nsfw": false,
22
+ "api": {
23
+ "search": "/posts.json?",
24
+ "postView": "/post/show/"
25
+ },
26
+ "random": true,
27
+ "defaultTags": ["rating:safe"]
28
+ },
29
+ "hypnohub.net": {
30
+ "domain": "hypnohub.net",
31
+ "aliases": [
32
+ "hh",
33
+ "hypno",
34
+ "hypnohub"
35
+ ],
36
+ "nsfw": true,
37
+ "api": {
38
+ "search": "/index.php?page=dapi&s=post&q=index&json=1&",
39
+ "postView": "/post/show/"
40
+ },
41
+ "paginate": "pid",
42
+ "random": false
43
+ },
44
+ "danbooru.donmai.us": {
45
+ "domain": "danbooru.donmai.us",
46
+ "aliases": [
47
+ "db",
48
+ "dan",
49
+ "danbooru"
50
+ ],
51
+ "nsfw": true,
52
+ "api": {
53
+ "search": "/posts.json?",
54
+ "postView": "/posts/"
55
+ },
56
+ "random": true
57
+ },
58
+ "konachan.com": {
59
+ "domain": "konachan.com",
60
+ "aliases": [
61
+ "kc",
62
+ "konac",
63
+ "kcom"
64
+ ],
65
+ "nsfw": true,
66
+ "api": {
67
+ "search": "/post.json?",
68
+ "postView": "/post/show/"
69
+ },
70
+ "random": true
71
+ },
72
+ "konachan.net": {
73
+ "domain": "konachan.net",
74
+ "aliases": [
75
+ "kn",
76
+ "konan",
77
+ "knet"
78
+ ],
79
+ "nsfw": false,
80
+ "api": {
81
+ "search": "/post.json?",
82
+ "postView": "/post/show/"
83
+ },
84
+ "random": true
85
+ },
86
+ "yande.re": {
87
+ "domain": "yande.re",
88
+ "aliases": [
89
+ "yd",
90
+ "yand",
91
+ "yandere"
92
+ ],
93
+ "nsfw": true,
94
+ "api": {
95
+ "search": "/post.json?",
96
+ "postView": "/post/show/"
97
+ },
98
+ "random": true
99
+ },
100
+ "gelbooru.com": {
101
+ "domain": "gelbooru.com",
102
+ "aliases": [
103
+ "gb",
104
+ "gel",
105
+ "gelbooru"
106
+ ],
107
+ "nsfw": true,
108
+ "api": {
109
+ "search": "/index.php?page=dapi&s=post&q=index&json=1&",
110
+ "postView": "/index.php?page=post&s=view&json=1&id="
111
+ },
112
+ "paginate": "pid",
113
+ "random": false
114
+ },
115
+ "rule34.xxx": {
116
+ "domain": "api.rule34.xxx",
117
+ "aliases": [
118
+ "r34",
119
+ "rule34"
120
+ ],
121
+ "nsfw": true,
122
+ "api": {
123
+ "search": "/index.php?page=dapi&s=post&q=index&json=1&",
124
+ "postView": "/index.php?page=post&s=view&json=1&id="
125
+ },
126
+ "paginate": "pid",
127
+ "random": false
128
+ },
129
+ "safebooru.org": {
130
+ "domain": "safebooru.org",
131
+ "aliases": [
132
+ "sb",
133
+ "safe",
134
+ "safebooru"
135
+ ],
136
+ "nsfw": false,
137
+ "api": {
138
+ "search": "/index.php?page=dapi&s=post&q=index&json=1&",
139
+ "postView": "/index.php?page=post&s=view&json=1&id="
140
+ },
141
+ "paginate": "pid",
142
+ "random": false
143
+ },
144
+ "tbib.org": {
145
+ "domain": "tbib.org",
146
+ "aliases": [
147
+ "tb",
148
+ "tbib",
149
+ "big"
150
+ ],
151
+ "nsfw": false,
152
+ "api": {
153
+ "search": "/index.php?page=dapi&s=post&q=index&json=1&",
154
+ "postView": "/index.php?page=post&s=view&json=1&id="
155
+ },
156
+ "paginate": "pid",
157
+ "random": false
158
+ },
159
+ "xbooru.com": {
160
+ "domain": "xbooru.com",
161
+ "aliases": [
162
+ "xb",
163
+ "xbooru"
164
+ ],
165
+ "nsfw": true,
166
+ "api": {
167
+ "search": "/index.php?page=dapi&s=post&q=index&json=1&",
168
+ "postView": "/index.php?page=post&s=view&json=1&id="
169
+ },
170
+ "paginate": "pid",
171
+ "random": false
172
+ },
173
+ "rule34.paheal.net": {
174
+ "domain": "rule34.paheal.net",
175
+ "type": "xml",
176
+ "aliases": [
177
+ "pa",
178
+ "paheal"
179
+ ],
180
+ "nsfw": true,
181
+ "api": {
182
+ "search": "/api/danbooru/find_posts?",
183
+ "postView": "/post/view/"
184
+ },
185
+ "random": false
186
+ },
187
+ "derpibooru.org": {
188
+ "domain": "derpibooru.org",
189
+ "type": "derpi",
190
+ "aliases": [
191
+ "dp",
192
+ "derp",
193
+ "derpi",
194
+ "derpibooru"
195
+ ],
196
+ "nsfw": true,
197
+ "api": {
198
+ "search": "/api/v1/json/search/images?",
199
+ "postView": "/images/"
200
+ },
201
+ "tagQuery": "q",
202
+ "tagJoin": ",",
203
+ "random": "sf=random"
204
+ },
205
+ "realbooru.com": {
206
+ "domain": "realbooru.com",
207
+ "aliases": [
208
+ "rb",
209
+ "realbooru"
210
+ ],
211
+ "nsfw": true,
212
+ "api": {
213
+ "search": "/index.php?page=dapi&s=post&q=index&json=1&",
214
+ "postView": "/index.php?page=post&s=view&id="
215
+ },
216
+ "paginate": "pid",
217
+ "random": false
218
+ }
219
+ }
@@ -2,7 +2,7 @@
2
2
  * @packageDocumentation
3
3
  * @module Structures
4
4
  */
5
- import SearchParameters from './SearchParameters';
5
+ import type SearchParameters from './SearchParameters';
6
6
  /**
7
7
  * Interface for {@link Booru}'s **private internal** search params pls no use
8
8
  */
@@ -14,3 +14,4 @@ export default interface InternalSearchParameters extends SearchParameters {
14
14
  /** The tags used in the search */
15
15
  tags?: string[];
16
16
  }
17
+ //# sourceMappingURL=InternalSearchParameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InternalSearchParameters.d.ts","sourceRoot":"","sources":["../../src/structures/InternalSearchParameters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAA;AAEtD;;GAEG;AAEH,MAAM,CAAC,OAAO,WAAW,wBAAyB,SAAQ,gBAAgB;IACxE,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"InternalSearchParameters.js","sourceRoot":"","sources":["../../src/structures/InternalSearchParameters.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
1
+ {"version":3,"file":"InternalSearchParameters.js","sourceRoot":"","sources":["../../src/structures/InternalSearchParameters.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * @packageDocumentation\n * @module Structures\n */\n\nimport type SearchParameters from './SearchParameters'\n\n/**\n * Interface for {@link Booru}'s **private internal** search params pls no use\n */\n\nexport default interface InternalSearchParameters extends SearchParameters {\n /** The uri to override with, if provided */\n uri?: string | null\n /** If `order:random` should be faked */\n fakeLimit?: number\n /** The tags used in the search */\n tags?: string[]\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * @packageDocumentation
3
3
  * @module Structures
4
4
  */
5
- import Booru from '../boorus/Booru';
5
+ import type Booru from '../boorus/Booru';
6
6
  /**
7
7
  * An image from a booru with a few common props
8
8
  *
@@ -132,3 +132,4 @@ export default class Post {
132
132
  */
133
133
  get common(): this;
134
134
  }
135
+ //# sourceMappingURL=Post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Post.d.ts","sourceRoot":"","sources":["../../src/structures/Post.ts"],"names":[],"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ACH,IAAI,UAAU,IAAI,MAAM,GAAG,IAAI,CAE9B;IAED;;;OAGG;IACH,IAAI,aAAa,IAAI,MAAM,GAAG,IAAI,CAEjC;IAED;;;OAGG;IACH,IAAI,YAAY,IAAI,MAAM,GAAG,IAAI,CAEhC;IAED;;;OAGG;IACH,IAAI,WAAW,IAAI,MAAM,GAAG,IAAI,CAE/B;IAED;;;OAGG;IACH,IAAI,cAAc,IAAI,MAAM,GAAG,IAAI,CAElC;IAED;;;OAGG;IACH,IAAI,aAAa,IAAI,MAAM,GAAG,IAAI,CAEjC;IAED;;;;;;;;;;;;OAYG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;;;;;;;;;;;;;;OAeG;IACH,IAAI,MAAM,IAAI,IAAI,CAGjB;CACF"}
@@ -4,9 +4,8 @@
4
4
  * @module Structures
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- const util_1 = require("util");
8
- // eslint-disable-next-line no-empty,@typescript-eslint/no-empty-function
9
- const common = (0, util_1.deprecate)(() => { }, 'Common is now deprecated, just access the properties directly');
7
+ const node_util_1 = require("node:util");
8
+ const common = (0, node_util_1.deprecate)(() => { }, 'Common is now deprecated, just access the properties directly');
10
9
  /**
11
10
  * Tries to figure out what the image url should be
12
11
  *
@@ -15,22 +14,26 @@ const common = (0, util_1.deprecate)(() => { }, 'Common is now deprecated, just
15
14
  * @param {Booru} booru so hard
16
15
  */
17
16
  function parseImageUrl(url, data, booru) {
17
+ let outUrl = url;
18
18
  // If the image's file_url is *still* undefined or the source is empty or it's deleted
19
19
  // Thanks danbooru *grumble grumble*
20
- if (!url || url.trim() === '' || data.is_deleted) {
20
+ if (!outUrl || outUrl.trim() === '' || data.is_deleted) {
21
21
  return null;
22
22
  }
23
- if (url.startsWith('/data')) {
24
- url = `https://danbooru.donmai.us${url}`;
23
+ if (outUrl.startsWith('/data')) {
24
+ outUrl = `https://danbooru.donmai.us${outUrl}`;
25
25
  }
26
- if (url.startsWith('/cached')) {
27
- url = `https://danbooru.donmai.us${url}`;
26
+ if (outUrl.startsWith('/cached')) {
27
+ outUrl = `https://danbooru.donmai.us${outUrl}`;
28
28
  }
29
- if (url.startsWith('/_images')) {
30
- url = `https://dollbooru.org${url}`;
29
+ if (outUrl.startsWith('/_images')) {
30
+ outUrl = `https://dollbooru.org${outUrl}`;
31
31
  }
32
- if (url.startsWith('//derpicdn.net')) {
33
- url = `https:${data.image}`;
32
+ if (outUrl.startsWith('//derpicdn.net')) {
33
+ outUrl = `https:${data.image}`;
34
+ }
35
+ if (outUrl.startsWith('/_thumbs')) {
36
+ outUrl = `https://rule34.paheal.net${outUrl}`;
34
37
  }
35
38
  // Why???
36
39
  if (!data.file_url && data.directory !== undefined) {
@@ -41,16 +44,16 @@ function parseImageUrl(url, data, booru) {
41
44
  // for some ungodly reason
42
45
  // I despise the danbooru api honestly
43
46
  const directory = data.directory ?? `${data.hash.substr(0, 2)}/${data.hash.substr(2, 2)}`;
44
- url = `//${booru.domain}/images/${directory}/${data.image}`;
47
+ outUrl = `//${booru.domain}/images/${directory}/${data.image}`;
45
48
  }
46
- if (!url.startsWith('http')) {
47
- url = `https:${url}`;
49
+ if (!outUrl.startsWith('http')) {
50
+ outUrl = `https:${outUrl}`;
48
51
  }
49
52
  if (booru.domain === 'xbooru.com' &&
50
- url.startsWith('https://api-cdn.rule34.xxx/')) {
51
- url = url.replace('https://api-cdn.rule34.xxx/', 'https://xbooru.com/');
53
+ outUrl.startsWith('https://api-cdn.rule34.xxx/')) {
54
+ outUrl = outUrl.replace('https://api-cdn.rule34.xxx/', 'https://xbooru.com/');
52
55
  }
53
- return encodeURI(url);
56
+ return encodeURI(outUrl);
54
57
  }
55
58
  /**
56
59
  * Takes and transforms tags from the booru's api into a common format
@@ -63,7 +66,7 @@ function getTags(data) {
63
66
  if (Array.isArray(data.tags)) {
64
67
  tags = data.tags;
65
68
  }
66
- else if (data.tags && data.tags.general) {
69
+ else if (data.tags?.general) {
67
70
  tags = Object.values(data.tags).flat();
68
71
  }
69
72
  else if (typeof data.tags === 'string') {
@@ -148,44 +151,43 @@ class Post {
148
151
  * @param {Booru} booru The booru that created the image
149
152
  */
150
153
  constructor(data, booru) {
151
- // eslint-disable-next-line complexity
152
154
  // Damn wild mix of boorus
153
155
  this.data = data;
154
156
  this.booru = booru;
155
157
  // Again, thanks danbooru
156
158
  const deletedOrBanned = data.is_deleted || data.is_banned;
157
- this.fileUrl = parseImageUrl(data.file_url ||
158
- data.image ||
159
- (deletedOrBanned ? data.source : undefined) ||
160
- (data.file && data.file.url) ||
161
- (data.representations && data.representations.full), data, booru);
159
+ this.fileUrl = parseImageUrl(data.file_url ??
160
+ data.image ??
161
+ (deletedOrBanned ? data.source : undefined) ??
162
+ data.file?.url ??
163
+ data.representations?.full, data, booru);
162
164
  this.available = !deletedOrBanned && this.fileUrl !== null;
163
- this.height = parseInt(data.height || data.image_height || (data.file && data.file.height), 10);
164
- this.width = parseInt(data.width || data.image_width || (data.file && data.file.width), 10);
165
- this.sampleUrl = parseImageUrl(data.sample_url ||
166
- data.large_file_url ||
167
- (data.representations && data.representations.large) ||
168
- (data.sample && data.sample.url), data, booru);
169
- this.sampleHeight = parseInt(data.sample_height || (data.sample && data.sample.height), 10);
170
- this.sampleWidth = parseInt(data.sample_width || (data.sample && data.sample.width), 10);
171
- this.previewUrl = parseImageUrl(data.preview_url ||
172
- data.preview_file_url ||
173
- (data.representations && data.representations.small) ||
174
- (data.preview && data.preview.url), data, booru);
175
- this.previewHeight = parseInt(data.preview_height || (data.preview && data.preview.height), 10);
176
- this.previewWidth = parseInt(data.preview_width || (data.preview && data.preview.width), 10);
165
+ this.height = Number.parseInt(data.height ?? data.image_height ?? data.file?.height, 10);
166
+ this.width = Number.parseInt(data.width ?? data.image_width ?? data.file?.width, 10);
167
+ this.sampleUrl = parseImageUrl(data.sample_url ??
168
+ data.large_file_url ??
169
+ data.representations?.large ??
170
+ data.sample?.url, data, booru);
171
+ this.sampleHeight = Number.parseInt(data.sample_height ?? data.sample?.height, 10);
172
+ this.sampleWidth = Number.parseInt(data.sample_width ?? data.sample?.width, 10);
173
+ this.previewUrl = parseImageUrl(data.preview_url ??
174
+ data.preview_file_url ??
175
+ data.representations?.small ??
176
+ data.preview?.url, data, booru);
177
+ this.previewHeight = Number.parseInt(data.preview_height ?? data.preview?.height, 10);
178
+ this.previewWidth = Number.parseInt(data.preview_width ?? data.preview?.width, 10);
177
179
  this.id = data.id ? data.id.toString() : 'No ID available';
178
180
  this.tags = getTags(data);
179
181
  if (data.score && data.score.total !== undefined) {
180
182
  this.score = data.score.total;
181
183
  }
182
184
  else {
183
- this.score = data.score ? parseInt(data.score, 10) : data.score;
185
+ this.score = data.score ? Number.parseInt(data.score, 10) : data.score;
184
186
  }
185
- this.source = data.source || data.sources || data.source_url;
187
+ this.source = data.source ?? data.sources ?? data.source_url;
186
188
  this.rating =
187
- data.rating ||
188
- /(safe|suggestive|questionable|explicit)/i.exec(data.tags) ||
189
+ data.rating ??
190
+ /(safe|suggestive|questionable|explicit)/i.exec(data.tags) ??
189
191
  'u';
190
192
  if (Array.isArray(this.rating)) {
191
193
  this.rating = this.rating[0];
@@ -210,7 +212,7 @@ class Post {
210
212
  this.createdAt = new Date(data.change * 1000);
211
213
  }
212
214
  else {
213
- this.createdAt = new Date(data.created_at || data.date);
215
+ this.createdAt = new Date(data.created_at ?? data.date);
214
216
  }
215
217
  }
216
218
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Post.js","sourceRoot":"","sources":["../../src/structures/Post.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,+BAAgC;AAGhC,yEAAyE;AACzE,MAAM,MAAM,GAAG,IAAA,gBAAS,EACtB,GAAG,EAAE,GAAE,CAAC,EACR,+DAA+D,CAChE,CAAA;AAED;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,GAAW,EAAE,IAAS,EAAE,KAAY;IACzD,sFAAsF;IACtF,oCAAoC;IACpC,IAAI,CAAC,GAAG,IAAI,GAAG,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;;;;;;;;;OAYG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACrC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,IAAI,MAAM;QACR,MAAM,EAAE,CAAA;QACR,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAxPD,uBAwPC","sourcesContent":["/**\n * @packageDocumentation\n * @module Structures\n */\n\nimport { deprecate } from 'node:util'\nimport type Booru from '../boorus/Booru'\n\nconst common = deprecate(\n () => {},\n 'Common is now deprecated, just access the properties directly',\n)\n\n/**\n * Tries to figure out what the image url should be\n *\n * @param {string} url why\n * @param {*} data boorus\n * @param {Booru} booru so hard\n */\nfunction parseImageUrl(url: string, data: any, booru: Booru): string | null {\n let outUrl = url\n\n // If the image's file_url is *still* undefined or the source is empty or it's deleted\n // Thanks danbooru *grumble grumble*\n if (!outUrl || outUrl.trim() === '' || data.is_deleted) {\n return null\n }\n\n if (outUrl.startsWith('/data')) {\n outUrl = `https://danbooru.donmai.us${outUrl}`\n }\n\n if (outUrl.startsWith('/cached')) {\n outUrl = `https://danbooru.donmai.us${outUrl}`\n }\n\n if (outUrl.startsWith('/_images')) {\n outUrl = `https://dollbooru.org${outUrl}`\n }\n\n if (outUrl.startsWith('//derpicdn.net')) {\n outUrl = `https:${data.image}`\n }\n\n if (outUrl.startsWith('/_thumbs')) {\n outUrl = `https://rule34.paheal.net${outUrl}`\n }\n\n // Why???\n if (!data.file_url && data.directory !== undefined) {\n // Danbooru-based boorus sometimes sort their files into directories\n // There's 2 directories, one named after the first 2 characters of the hash\n // and one named after the next 2 characters of the hash\n // Sometimes we get it in the API response as `data.directory`, sometimes it's null\n // for some ungodly reason\n // I despise the danbooru api honestly\n const directory =\n data.directory ?? `${data.hash.substr(0, 2)}/${data.hash.substr(2, 2)}`\n outUrl = `//${booru.domain}/images/${directory}/${data.image}`\n }\n\n if (!outUrl.startsWith('http')) {\n outUrl = `https:${outUrl}`\n }\n\n if (\n booru.domain === 'xbooru.com' &&\n outUrl.startsWith('https://api-cdn.rule34.xxx/')\n ) {\n outUrl = outUrl.replace(\n 'https://api-cdn.rule34.xxx/',\n 'https://xbooru.com/',\n )\n }\n\n return encodeURI(outUrl)\n}\n\n/**\n * Takes and transforms tags from the booru's api into a common format\n * (which is an array of strings)\n * @param {any} data The data from the booru\n * @returns {string[]} The tags as a string array, and not just a string or an object\n */\nfunction getTags(data: any): string[] {\n let tags: string[] = []\n\n if (Array.isArray(data.tags)) {\n tags = data.tags\n } else if (data.tags?.general) {\n tags = Object.values<string>(data.tags).flat()\n } else if (typeof data.tags === 'string') {\n tags = fromTagString(data.tags)\n } else if (typeof data.tag_string === 'string') {\n tags = fromTagString(data.tag_string)\n }\n\n return tags.filter((v) => v !== '')\n}\n\n/**\n * Parses a string of tags into an array of tags, doing some sanitization\n *\n * @example\n * fromTagString('tag1 tag2 tag3') => ['tag1', 'tag2', 'tag3']\n * fromTagString('tag1 tag,2 tag3 ') => ['tag1', 'tag2', 'tag3']\n * @param tags The tags as a string\n * @returns The string, parsed into an array of tags\n */\nfunction fromTagString(tags: string): string[] {\n return tags.split(' ').map((v) => v.replace(/,/g, ''))\n}\n\n/**\n * An image from a booru with a few common props\n *\n * @example\n * ```\n * Post {\n * fileUrl: 'https://aaaa.com/image.jpg',\n * id: '124125',\n * tags: ['cat', 'cute'],\n * score: 5,\n * source: 'https://giraffeduck.com/aaaa.png',\n * rating: 's'\n * }\n * ```\n */\nexport default class Post {\n /** The {@link Booru} it came from */\n public booru: Booru\n /** The direct link to the file */\n public fileUrl: string | null\n /** The height of the file */\n public height: number\n /** The width of the file */\n public width: number\n /** The url to the medium-sized image (if available) */\n public sampleUrl: string | null\n /** The height of the medium-sized image (if available) */\n public sampleHeight: number | null\n /** The width of the medium-sized image (if available) */\n public sampleWidth: number | null\n /** The url to the smallest image (if available) */\n public previewUrl: string | null\n /** The height of the smallest image (if available) */\n public previewHeight: number | null\n /** The width of the smallest image (if available) */\n public previewWidth: number | null\n /** The id of this post */\n public id: string\n /** If this post is available (ie. not deleted, not banned, has file url) */\n public available: boolean\n /** The tags of this post */\n public tags: string[]\n /** The score of this post */\n public score: number\n /** The source of this post, if available */\n public source?: string | string[]\n /**\n * The rating of the image, as just the first letter\n * (s/q/e/u) => safe/questionable/explicit/unrated\n */\n public rating: string\n /** The Date this post was created at */\n public createdAt?: Date | null\n /** All the data given by the booru @private */\n protected data: any\n\n /**\n * Create an image from a booru\n *\n * @param {Object} data The raw data from the Booru\n * @param {Booru} booru The booru that created the image\n */\n constructor(data: any, booru: Booru) {\n // Damn wild mix of boorus\n this.data = data\n this.booru = booru\n\n // Again, thanks danbooru\n const deletedOrBanned = data.is_deleted || data.is_banned\n\n this.fileUrl = parseImageUrl(\n data.file_url ??\n data.image ??\n (deletedOrBanned ? data.source : undefined) ??\n data.file?.url ??\n data.representations?.full,\n data,\n booru,\n )\n\n this.available = !deletedOrBanned && this.fileUrl !== null\n\n this.height = Number.parseInt(\n data.height ?? data.image_height ?? data.file?.height,\n 10,\n )\n this.width = Number.parseInt(\n data.width ?? data.image_width ?? data.file?.width,\n 10,\n )\n\n this.sampleUrl = parseImageUrl(\n data.sample_url ??\n data.large_file_url ??\n data.representations?.large ??\n data.sample?.url,\n data,\n booru,\n )\n\n this.sampleHeight = Number.parseInt(\n data.sample_height ?? data.sample?.height,\n 10,\n )\n this.sampleWidth = Number.parseInt(\n data.sample_width ?? data.sample?.width,\n 10,\n )\n\n this.previewUrl = parseImageUrl(\n data.preview_url ??\n data.preview_file_url ??\n data.representations?.small ??\n data.preview?.url,\n data,\n booru,\n )\n\n this.previewHeight = Number.parseInt(\n data.preview_height ?? data.preview?.height,\n 10,\n )\n this.previewWidth = Number.parseInt(\n data.preview_width ?? data.preview?.width,\n 10,\n )\n\n this.id = data.id ? data.id.toString() : 'No ID available'\n this.tags = getTags(data)\n\n if (data.score && data.score.total !== undefined) {\n this.score = data.score.total\n } else {\n this.score = data.score ? Number.parseInt(data.score, 10) : data.score\n }\n\n this.source = data.source ?? data.sources ?? data.source_url\n this.rating =\n data.rating ??\n /(safe|suggestive|questionable|explicit)/i.exec(data.tags) ??\n 'u'\n\n if (Array.isArray(this.rating)) {\n this.rating = this.rating[0]\n }\n\n // Thanks derpibooru\n if (this.rating === 'suggestive') {\n this.rating = 'q'\n }\n\n this.rating = this.rating.charAt(0)\n\n this.createdAt = null\n // eslint-disable-next-line\n if (typeof data.created_at === 'object') {\n this.createdAt = new Date(\n data.created_at.s * 1000 + data.created_at.n / 1000000000,\n )\n } else if (typeof data.created_at === 'number') {\n this.createdAt = new Date(data.created_at * 1000)\n } else if (typeof data.created_at === 'string') {\n this.createdAt = new Date(data.created_at)\n } else if (typeof data.change === 'number') {\n this.createdAt = new Date(data.change * 1000)\n } else {\n this.createdAt = new Date(data.created_at ?? data.date)\n }\n }\n\n /**\n * The direct link to the file\n * <p>It's prefered to use `.fileUrl` instead because camelCase\n */\n get file_url(): string | null {\n return this.fileUrl\n }\n\n /**\n * The url to the medium-sized image (if available)\n * <p>It's prefered to use `.sampleUrl` instead because camelCase\n */\n get sample_url(): string | null {\n return this.sampleUrl\n }\n\n /**\n * The height of the medium-sized image (if available)\n * <p>It's prefered to use `.sampleHeight` instead because camelCase\n */\n get sample_height(): number | null {\n return this.sampleHeight\n }\n\n /**\n * The width of the medium-sized image (if available)\n * <p>It's prefered to use `.sampleWidth` instead because camelCase\n */\n get sample_width(): number | null {\n return this.sampleWidth\n }\n\n /**\n * The url to the smallest image (if available)\n * <p>It's prefered to use `.previewUrl` instead because camelCase\n */\n get preview_url(): string | null {\n return this.previewUrl\n }\n\n /**\n * The height of the smallest image (if available)\n * <p>It's prefered to use `.previewHeight` instead because camelCase\n */\n get preview_height(): number | null {\n return this.previewHeight\n }\n\n /**\n * The width of the smallest image (if available)\n * <p>It's prefered to use `.previewWidth` instead because camelCase\n */\n get preview_width(): number | null {\n return this.previewWidth\n }\n\n /**\n * Get the post view (url to the post) of this image\n *\n * @type {String}\n * @example\n * ```\n * const e9 = Booru('e9')\n * const imgs = e9.search(['cat', 'dog'])\n *\n * // Log the post url of the first image\n * console.log(imgs[0].postView)\n * ```\n */\n get postView(): string {\n return this.booru.postView(this.id)\n }\n\n /**\n * Get some common props on the image\n *\n * @deprecated All common props are now attached directly to the image\n * @type {Object}\n *\n * @example\n * ```\n * image.id\n * // deprecated, use this instead\n * image.id\n *\n * // To access the post's raw data from the booru, do\n * image._data.id\n * ```\n */\n get common(): this {\n common()\n return this\n }\n}\n"]}
@@ -7,11 +7,12 @@
7
7
  */
8
8
  export default interface SearchParameters {
9
9
  /** The limit on *max* posts to show, you might get less posts than this */
10
- limit?: number;
10
+ limit?: number | undefined;
11
11
  /** Should posts be in random order, implementation differs per booru */
12
- random?: boolean;
12
+ random?: boolean | undefined;
13
13
  /** Which page of results to fetch */
14
- page?: number;
14
+ page?: number | undefined;
15
15
  /** Return unavailable posts (ie. banned/deleted posts) */
16
- showUnavailable?: boolean;
16
+ showUnavailable?: boolean | undefined;
17
17
  }
18
+ //# sourceMappingURL=SearchParameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchParameters.d.ts","sourceRoot":"","sources":["../../src/structures/SearchParameters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,gBAAgB;IACvC,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,wEAAwE;IACxE,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,0DAA0D;IAC1D,eAAe,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SearchParameters.js","sourceRoot":"","sources":["../../src/structures/SearchParameters.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
1
+ {"version":3,"file":"SearchParameters.js","sourceRoot":"","sources":["../../src/structures/SearchParameters.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * @packageDocumentation\n * @module Structures\n */\n\n/**\n * Just an interface for {@link Booru}'s search params :)\n */\nexport default interface SearchParameters {\n /** The limit on *max* posts to show, you might get less posts than this */\n limit?: number | undefined\n /** Should posts be in random order, implementation differs per booru */\n random?: boolean | undefined\n /** Which page of results to fetch */\n page?: number | undefined\n /** Return unavailable posts (ie. banned/deleted posts) */\n showUnavailable?: boolean | undefined\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  * @packageDocumentation
3
3
  * @module Structures
4
4
  */
5
- import Booru from '../boorus/Booru';
6
- import Post from '../structures/Post';
7
- import SearchParameters from './SearchParameters';
5
+ import type Booru from '../boorus/Booru';
6
+ import type Post from '../structures/Post';
7
+ import type SearchParameters from './SearchParameters';
8
8
  /**
9
9
  * Represents a page of search results, works like an array of {@link Post}
10
10
  * <p> Usable like an array and allows to easily get the next page
@@ -71,3 +71,4 @@ export default class SearchResults extends Array<Post> {
71
71
  */
72
72
  blacklist(tags: string[] | string): SearchResults;
73
73
  }
74
+ //# sourceMappingURL=SearchResults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchResults.d.ts","sourceRoot":"","sources":["../../src/structures/SearchResults.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AACxC,OAAO,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAC1C,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAA;AAEtD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,KAAK,CAAC,IAAI,CAAC;IACpD,qCAAqC;IAC9B,KAAK,EAAE,KAAK,CAAA;IACnB,8BAA8B;IACvB,IAAI,EAAE,MAAM,CAAA;IACnB,oCAAoC;IACpC,SAAgB,IAAI,EAAE,MAAM,EAAE,CAAA;IAC9B,uCAAuC;IACvC,SAAgB,OAAO,EAAE,gBAAgB,CAAA;IACzC,wCAAwC;IACxC,SAAgB,KAAK,EAAE,IAAI,EAAE,CAAA;IAE7B,eAAe;gBAEb,KAAK,EAAE,IAAI,EAAE,EACb,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,gBAAgB,EACzB,KAAK,EAAE,KAAK;IAed;;;OAGG;IACH,IAAI,KAAK,IAAI,IAAI,CAEhB;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,IAAI,CAEf;IAED;;;;OAIG;IACI,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC;IAOzC;;;;;;;;OAQG;IACI,MAAM,CACX,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EACvB,EAAE,MAAc,EAAE;;KAAK,GACtB,aAAa;IAchB;;;;OAIG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,aAAa;CAGzD"}
@@ -19,13 +19,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
19
19
  }) : function(o, v) {
20
20
  o["default"] = v;
21
21
  });
22
- var __importStar = (this && this.__importStar) || function (mod) {
23
- if (mod && mod.__esModule) return mod;
24
- var result = {};
25
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26
- __setModuleDefault(result, mod);
27
- return result;
28
- };
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
29
39
  Object.defineProperty(exports, "__esModule", { value: true });
30
40
  const Utils = __importStar(require("../Utils"));
31
41
  /**
@@ -67,7 +77,7 @@ class SearchResults extends Array {
67
77
  this.tags = tags;
68
78
  this.options = options;
69
79
  this.booru = booru;
70
- this.page = options ? options.page || 0 : 0;
80
+ this.page = options ? (options.page ?? 0) : 0;
71
81
  }
72
82
  /**
73
83
  * Get the first post in this result set
@@ -103,12 +113,10 @@ class SearchResults extends Array {
103
113
  * @return {SearchResults}
104
114
  */
105
115
  tagged(tags, { invert = false } = {}) {
106
- if (!Array.isArray(tags)) {
107
- tags = [tags];
108
- }
116
+ const searchTags = Array.isArray(tags) ? tags : [tags];
109
117
  const posts = [];
110
118
  for (const p of this) {
111
- const m = Utils.compareArrays(tags, p.tags).length;
119
+ const m = Utils.compareArrays(searchTags, p.tags).length;
112
120
  if ((!invert && m > 0) || (invert && m === 0)) {
113
121
  posts.push(p);
114
122
  }