feedsmith 3.0.0-next.5 → 3.0.0-rc.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 (326) hide show
  1. package/README.md +1 -1
  2. package/dist/common/config.cjs +103 -274
  3. package/dist/common/config.js +102 -273
  4. package/dist/common/errors.cjs +30 -0
  5. package/dist/common/errors.d.cts +15 -0
  6. package/dist/common/errors.d.ts +15 -0
  7. package/dist/common/errors.js +27 -0
  8. package/dist/common/parse.cjs +13 -14
  9. package/dist/common/parse.d.cts +12 -12
  10. package/dist/common/parse.d.ts +12 -12
  11. package/dist/common/parse.js +4 -5
  12. package/dist/common/types.d.cts +9 -8
  13. package/dist/common/types.d.ts +9 -8
  14. package/dist/common/utils.cjs +146 -75
  15. package/dist/common/utils.js +127 -59
  16. package/dist/feeds/atom/common/types.d.cts +12 -8
  17. package/dist/feeds/atom/common/types.d.ts +12 -8
  18. package/dist/feeds/atom/detect/index.cjs +8 -8
  19. package/dist/feeds/atom/detect/index.js +6 -6
  20. package/dist/feeds/atom/generate/config.cjs +3 -6
  21. package/dist/feeds/atom/generate/config.js +1 -3
  22. package/dist/feeds/atom/generate/index.cjs +7 -8
  23. package/dist/feeds/atom/generate/index.d.cts +3 -3
  24. package/dist/feeds/atom/generate/index.d.ts +3 -3
  25. package/dist/feeds/atom/generate/index.js +3 -4
  26. package/dist/feeds/atom/generate/utils.cjs +48 -36
  27. package/dist/feeds/atom/generate/utils.js +17 -13
  28. package/dist/feeds/atom/parse/config.cjs +12 -5
  29. package/dist/feeds/atom/parse/config.js +10 -5
  30. package/dist/feeds/atom/parse/index.cjs +15 -11
  31. package/dist/feeds/atom/parse/index.d.cts +3 -3
  32. package/dist/feeds/atom/parse/index.d.ts +3 -3
  33. package/dist/feeds/atom/parse/index.js +13 -9
  34. package/dist/feeds/atom/parse/utils.cjs +91 -65
  35. package/dist/feeds/atom/parse/utils.js +55 -42
  36. package/dist/feeds/json/common/types.d.cts +5 -5
  37. package/dist/feeds/json/common/types.d.ts +5 -5
  38. package/dist/feeds/json/detect/index.cjs +7 -8
  39. package/dist/feeds/json/detect/index.js +4 -5
  40. package/dist/feeds/json/generate/index.cjs +7 -5
  41. package/dist/feeds/json/generate/index.d.cts +3 -3
  42. package/dist/feeds/json/generate/index.d.ts +3 -3
  43. package/dist/feeds/json/generate/index.js +6 -4
  44. package/dist/feeds/json/generate/utils.cjs +11 -6
  45. package/dist/feeds/json/generate/utils.js +9 -5
  46. package/dist/feeds/json/parse/index.cjs +8 -9
  47. package/dist/feeds/json/parse/index.d.cts +3 -3
  48. package/dist/feeds/json/parse/index.d.ts +3 -3
  49. package/dist/feeds/json/parse/index.js +4 -5
  50. package/dist/feeds/json/parse/utils.cjs +47 -43
  51. package/dist/feeds/json/parse/utils.js +42 -43
  52. package/dist/feeds/rdf/common/types.d.cts +5 -5
  53. package/dist/feeds/rdf/common/types.d.ts +5 -5
  54. package/dist/feeds/rdf/detect/index.cjs +8 -8
  55. package/dist/feeds/rdf/detect/index.js +6 -6
  56. package/dist/feeds/rdf/parse/config.cjs +12 -4
  57. package/dist/feeds/rdf/parse/config.js +10 -4
  58. package/dist/feeds/rdf/parse/index.cjs +15 -11
  59. package/dist/feeds/rdf/parse/index.d.cts +3 -3
  60. package/dist/feeds/rdf/parse/index.d.ts +3 -3
  61. package/dist/feeds/rdf/parse/index.js +13 -9
  62. package/dist/feeds/rdf/parse/utils.cjs +38 -32
  63. package/dist/feeds/rdf/parse/utils.js +19 -20
  64. package/dist/feeds/rss/common/types.d.cts +12 -13
  65. package/dist/feeds/rss/common/types.d.ts +12 -13
  66. package/dist/feeds/rss/detect/index.cjs +9 -8
  67. package/dist/feeds/rss/detect/index.js +8 -7
  68. package/dist/feeds/rss/generate/config.cjs +3 -6
  69. package/dist/feeds/rss/generate/config.js +1 -3
  70. package/dist/feeds/rss/generate/index.cjs +7 -8
  71. package/dist/feeds/rss/generate/index.d.cts +3 -3
  72. package/dist/feeds/rss/generate/index.d.ts +3 -3
  73. package/dist/feeds/rss/generate/index.js +3 -4
  74. package/dist/feeds/rss/generate/utils.cjs +58 -51
  75. package/dist/feeds/rss/generate/utils.js +17 -21
  76. package/dist/feeds/rss/parse/config.cjs +36 -25
  77. package/dist/feeds/rss/parse/config.js +34 -25
  78. package/dist/feeds/rss/parse/index.cjs +15 -11
  79. package/dist/feeds/rss/parse/index.d.cts +3 -3
  80. package/dist/feeds/rss/parse/index.d.ts +3 -3
  81. package/dist/feeds/rss/parse/index.js +13 -9
  82. package/dist/feeds/rss/parse/utils.cjs +179 -58
  83. package/dist/feeds/rss/parse/utils.js +134 -29
  84. package/dist/index.cjs +21 -17
  85. package/dist/index.d.cts +52 -6
  86. package/dist/index.d.ts +52 -6
  87. package/dist/index.js +2 -2
  88. package/dist/namespaces/acast/common/config.cjs +18 -0
  89. package/dist/namespaces/acast/common/config.js +17 -0
  90. package/dist/namespaces/acast/generate/utils.cjs +9 -8
  91. package/dist/namespaces/acast/generate/utils.js +7 -8
  92. package/dist/namespaces/acast/parse/utils.cjs +9 -8
  93. package/dist/namespaces/acast/parse/utils.js +7 -8
  94. package/dist/namespaces/admin/common/config.cjs +11 -0
  95. package/dist/namespaces/admin/common/config.js +10 -0
  96. package/dist/namespaces/admin/generate/utils.cjs +4 -5
  97. package/dist/namespaces/admin/generate/utils.js +4 -5
  98. package/dist/namespaces/admin/parse/utils.cjs +4 -5
  99. package/dist/namespaces/admin/parse/utils.js +4 -5
  100. package/dist/namespaces/app/common/config.cjs +11 -0
  101. package/dist/namespaces/app/common/config.js +10 -0
  102. package/dist/namespaces/app/common/types.d.cts +1 -3
  103. package/dist/namespaces/app/common/types.d.ts +1 -3
  104. package/dist/namespaces/app/generate/utils.cjs +6 -6
  105. package/dist/namespaces/app/generate/utils.js +5 -6
  106. package/dist/namespaces/app/parse/utils.cjs +8 -8
  107. package/dist/namespaces/app/parse/utils.js +7 -8
  108. package/dist/namespaces/arxiv/common/config.cjs +16 -0
  109. package/dist/namespaces/arxiv/common/config.js +15 -0
  110. package/dist/namespaces/arxiv/generate/utils.cjs +7 -7
  111. package/dist/namespaces/arxiv/generate/utils.js +6 -7
  112. package/dist/namespaces/arxiv/parse/utils.cjs +7 -7
  113. package/dist/namespaces/arxiv/parse/utils.js +6 -7
  114. package/dist/namespaces/atom/common/config.cjs +11 -0
  115. package/dist/namespaces/atom/common/config.js +11 -0
  116. package/dist/namespaces/atom/common/types.d.cts +4 -4
  117. package/dist/namespaces/atom/common/types.d.ts +4 -4
  118. package/dist/namespaces/atom/generate/utils.cjs +2 -4
  119. package/dist/namespaces/atom/generate/utils.js +1 -3
  120. package/dist/namespaces/atom/parse/utils.cjs +6 -6
  121. package/dist/namespaces/atom/parse/utils.js +5 -5
  122. package/dist/namespaces/blogchannel/common/config.cjs +15 -0
  123. package/dist/namespaces/blogchannel/common/config.js +14 -0
  124. package/dist/namespaces/blogchannel/generate/utils.cjs +4 -5
  125. package/dist/namespaces/blogchannel/generate/utils.js +4 -5
  126. package/dist/namespaces/blogchannel/parse/utils.cjs +4 -5
  127. package/dist/namespaces/blogchannel/parse/utils.js +4 -5
  128. package/dist/namespaces/cc/common/config.cjs +25 -0
  129. package/dist/namespaces/cc/common/config.js +24 -0
  130. package/dist/namespaces/cc/generate/utils.cjs +4 -5
  131. package/dist/namespaces/cc/generate/utils.js +4 -5
  132. package/dist/namespaces/cc/parse/utils.cjs +4 -5
  133. package/dist/namespaces/cc/parse/utils.js +4 -5
  134. package/dist/namespaces/content/common/config.cjs +11 -0
  135. package/dist/namespaces/content/common/config.js +10 -0
  136. package/dist/namespaces/content/generate/utils.cjs +4 -5
  137. package/dist/namespaces/content/generate/utils.js +4 -5
  138. package/dist/namespaces/content/parse/utils.cjs +4 -5
  139. package/dist/namespaces/content/parse/utils.js +4 -5
  140. package/dist/namespaces/creativecommons/common/config.cjs +15 -0
  141. package/dist/namespaces/creativecommons/common/config.js +14 -0
  142. package/dist/namespaces/creativecommons/generate/utils.cjs +4 -5
  143. package/dist/namespaces/creativecommons/generate/utils.js +4 -5
  144. package/dist/namespaces/creativecommons/parse/utils.cjs +4 -5
  145. package/dist/namespaces/creativecommons/parse/utils.js +4 -5
  146. package/dist/namespaces/dc/common/config.cjs +35 -0
  147. package/dist/namespaces/dc/common/config.js +34 -0
  148. package/dist/namespaces/dc/common/types.d.cts +1 -3
  149. package/dist/namespaces/dc/common/types.d.ts +1 -3
  150. package/dist/namespaces/dc/generate/utils.cjs +4 -5
  151. package/dist/namespaces/dc/generate/utils.js +4 -5
  152. package/dist/namespaces/dc/parse/utils.cjs +6 -7
  153. package/dist/namespaces/dc/parse/utils.js +6 -7
  154. package/dist/namespaces/dcterms/common/config.cjs +75 -0
  155. package/dist/namespaces/dcterms/common/config.js +74 -0
  156. package/dist/namespaces/dcterms/common/types.d.cts +1 -3
  157. package/dist/namespaces/dcterms/common/types.d.ts +1 -3
  158. package/dist/namespaces/dcterms/generate/utils.cjs +4 -5
  159. package/dist/namespaces/dcterms/generate/utils.js +4 -5
  160. package/dist/namespaces/dcterms/parse/utils.cjs +14 -15
  161. package/dist/namespaces/dcterms/parse/utils.js +14 -15
  162. package/dist/namespaces/feedpress/common/config.cjs +25 -0
  163. package/dist/namespaces/feedpress/common/config.js +24 -0
  164. package/dist/namespaces/feedpress/generate/utils.cjs +4 -5
  165. package/dist/namespaces/feedpress/generate/utils.js +4 -5
  166. package/dist/namespaces/feedpress/parse/utils.cjs +4 -5
  167. package/dist/namespaces/feedpress/parse/utils.js +4 -5
  168. package/dist/namespaces/geo/common/config.cjs +10 -0
  169. package/dist/namespaces/geo/common/config.js +9 -0
  170. package/dist/namespaces/geo/generate/utils.cjs +4 -5
  171. package/dist/namespaces/geo/generate/utils.js +4 -5
  172. package/dist/namespaces/geo/parse/utils.cjs +4 -5
  173. package/dist/namespaces/geo/parse/utils.js +4 -5
  174. package/dist/namespaces/georss/common/config.cjs +22 -0
  175. package/dist/namespaces/georss/common/config.js +21 -0
  176. package/dist/namespaces/georss/generate/utils.cjs +13 -9
  177. package/dist/namespaces/georss/generate/utils.js +8 -9
  178. package/dist/namespaces/georss/parse/utils.cjs +16 -11
  179. package/dist/namespaces/georss/parse/utils.js +6 -6
  180. package/dist/namespaces/googleplay/common/config.cjs +22 -0
  181. package/dist/namespaces/googleplay/common/config.js +21 -0
  182. package/dist/namespaces/googleplay/generate/utils.cjs +6 -7
  183. package/dist/namespaces/googleplay/generate/utils.js +6 -7
  184. package/dist/namespaces/googleplay/parse/utils.cjs +10 -8
  185. package/dist/namespaces/googleplay/parse/utils.js +7 -8
  186. package/dist/namespaces/itunes/common/config.cjs +24 -0
  187. package/dist/namespaces/itunes/common/config.js +23 -0
  188. package/dist/namespaces/itunes/generate/utils.cjs +11 -9
  189. package/dist/namespaces/itunes/generate/utils.js +7 -8
  190. package/dist/namespaces/itunes/parse/utils.cjs +16 -11
  191. package/dist/namespaces/itunes/parse/utils.js +11 -11
  192. package/dist/namespaces/media/common/config.cjs +49 -0
  193. package/dist/namespaces/media/common/config.js +48 -0
  194. package/dist/namespaces/media/generate/utils.cjs +62 -32
  195. package/dist/namespaces/media/generate/utils.js +31 -32
  196. package/dist/namespaces/media/parse/utils.cjs +55 -24
  197. package/dist/namespaces/media/parse/utils.js +23 -24
  198. package/dist/namespaces/opensearch/common/config.cjs +17 -0
  199. package/dist/namespaces/opensearch/common/config.js +16 -0
  200. package/dist/namespaces/opensearch/generate/utils.cjs +6 -6
  201. package/dist/namespaces/opensearch/generate/utils.js +5 -6
  202. package/dist/namespaces/opensearch/parse/utils.cjs +6 -6
  203. package/dist/namespaces/opensearch/parse/utils.js +5 -6
  204. package/dist/namespaces/pingback/common/config.cjs +15 -0
  205. package/dist/namespaces/pingback/common/config.js +14 -0
  206. package/dist/namespaces/pingback/generate/utils.cjs +5 -6
  207. package/dist/namespaces/pingback/generate/utils.js +5 -6
  208. package/dist/namespaces/pingback/parse/utils.cjs +5 -6
  209. package/dist/namespaces/pingback/parse/utils.js +5 -6
  210. package/dist/namespaces/podcast/common/config.cjs +28 -0
  211. package/dist/namespaces/podcast/common/config.js +27 -0
  212. package/dist/namespaces/podcast/common/types.d.cts +5 -5
  213. package/dist/namespaces/podcast/common/types.d.ts +5 -5
  214. package/dist/namespaces/podcast/generate/utils.cjs +65 -36
  215. package/dist/namespaces/podcast/generate/utils.js +35 -36
  216. package/dist/namespaces/podcast/parse/utils.cjs +71 -39
  217. package/dist/namespaces/podcast/parse/utils.js +40 -39
  218. package/dist/namespaces/prism/common/config.cjs +138 -0
  219. package/dist/namespaces/prism/common/config.js +137 -0
  220. package/dist/namespaces/prism/common/types.d.cts +2 -4
  221. package/dist/namespaces/prism/common/types.d.ts +2 -4
  222. package/dist/namespaces/prism/generate/utils.cjs +5 -6
  223. package/dist/namespaces/prism/generate/utils.js +5 -6
  224. package/dist/namespaces/prism/parse/utils.cjs +24 -25
  225. package/dist/namespaces/prism/parse/utils.js +24 -25
  226. package/dist/namespaces/psc/common/config.cjs +9 -0
  227. package/dist/namespaces/psc/common/config.js +9 -0
  228. package/dist/namespaces/psc/generate/utils.cjs +7 -6
  229. package/dist/namespaces/psc/generate/utils.js +5 -6
  230. package/dist/namespaces/psc/parse/utils.cjs +7 -6
  231. package/dist/namespaces/psc/parse/utils.js +5 -6
  232. package/dist/namespaces/rawvoice/common/config.cjs +29 -0
  233. package/dist/namespaces/rawvoice/common/config.js +28 -0
  234. package/dist/namespaces/rawvoice/common/types.d.cts +3 -3
  235. package/dist/namespaces/rawvoice/common/types.d.ts +3 -3
  236. package/dist/namespaces/rawvoice/generate/utils.cjs +19 -13
  237. package/dist/namespaces/rawvoice/generate/utils.js +12 -13
  238. package/dist/namespaces/rawvoice/parse/utils.cjs +25 -19
  239. package/dist/namespaces/rawvoice/parse/utils.js +18 -19
  240. package/dist/namespaces/rdf/common/config.cjs +6 -0
  241. package/dist/namespaces/rdf/common/config.js +5 -0
  242. package/dist/namespaces/rdf/parse/utils.cjs +4 -5
  243. package/dist/namespaces/rdf/parse/utils.js +4 -5
  244. package/dist/namespaces/rss/common/config.cjs +9 -0
  245. package/dist/namespaces/rss/common/config.js +9 -0
  246. package/dist/namespaces/slash/common/config.cjs +16 -0
  247. package/dist/namespaces/slash/common/config.js +15 -0
  248. package/dist/namespaces/slash/generate/utils.cjs +4 -5
  249. package/dist/namespaces/slash/generate/utils.js +4 -5
  250. package/dist/namespaces/slash/parse/utils.cjs +5 -5
  251. package/dist/namespaces/slash/parse/utils.js +4 -5
  252. package/dist/namespaces/source/common/config.cjs +26 -0
  253. package/dist/namespaces/source/common/config.js +25 -0
  254. package/dist/namespaces/source/common/types.d.cts +7 -2
  255. package/dist/namespaces/source/common/types.d.ts +7 -2
  256. package/dist/namespaces/source/generate/utils.cjs +25 -13
  257. package/dist/namespaces/source/generate/utils.js +20 -13
  258. package/dist/namespaces/source/parse/utils.cjs +24 -13
  259. package/dist/namespaces/source/parse/utils.js +19 -13
  260. package/dist/namespaces/spotify/common/config.cjs +11 -0
  261. package/dist/namespaces/spotify/common/config.js +10 -0
  262. package/dist/namespaces/spotify/generate/utils.cjs +17 -12
  263. package/dist/namespaces/spotify/generate/utils.js +11 -12
  264. package/dist/namespaces/spotify/parse/utils.cjs +17 -12
  265. package/dist/namespaces/spotify/parse/utils.js +11 -12
  266. package/dist/namespaces/sy/common/config.cjs +15 -0
  267. package/dist/namespaces/sy/common/config.js +14 -0
  268. package/dist/namespaces/sy/common/types.d.cts +1 -3
  269. package/dist/namespaces/sy/common/types.d.ts +1 -3
  270. package/dist/namespaces/sy/generate/utils.cjs +4 -5
  271. package/dist/namespaces/sy/generate/utils.js +4 -5
  272. package/dist/namespaces/sy/parse/utils.cjs +6 -7
  273. package/dist/namespaces/sy/parse/utils.js +6 -7
  274. package/dist/namespaces/thr/common/config.cjs +15 -0
  275. package/dist/namespaces/thr/common/config.js +14 -0
  276. package/dist/namespaces/thr/common/types.d.cts +2 -2
  277. package/dist/namespaces/thr/common/types.d.ts +2 -2
  278. package/dist/namespaces/thr/generate/utils.cjs +7 -7
  279. package/dist/namespaces/thr/generate/utils.js +6 -7
  280. package/dist/namespaces/thr/parse/utils.cjs +9 -9
  281. package/dist/namespaces/thr/parse/utils.js +8 -9
  282. package/dist/namespaces/trackback/common/config.cjs +11 -0
  283. package/dist/namespaces/trackback/common/config.js +10 -0
  284. package/dist/namespaces/trackback/generate/utils.cjs +4 -5
  285. package/dist/namespaces/trackback/generate/utils.js +4 -5
  286. package/dist/namespaces/trackback/parse/utils.cjs +4 -5
  287. package/dist/namespaces/trackback/parse/utils.js +4 -5
  288. package/dist/namespaces/wfw/common/config.cjs +11 -0
  289. package/dist/namespaces/wfw/common/config.js +10 -0
  290. package/dist/namespaces/wfw/generate/utils.cjs +4 -5
  291. package/dist/namespaces/wfw/generate/utils.js +4 -5
  292. package/dist/namespaces/wfw/parse/utils.cjs +4 -5
  293. package/dist/namespaces/wfw/parse/utils.js +4 -5
  294. package/dist/namespaces/xml/generate/utils.cjs +4 -5
  295. package/dist/namespaces/xml/generate/utils.js +4 -5
  296. package/dist/namespaces/xml/parse/utils.cjs +4 -5
  297. package/dist/namespaces/xml/parse/utils.js +4 -5
  298. package/dist/namespaces/yt/common/config.cjs +15 -0
  299. package/dist/namespaces/yt/common/config.js +14 -0
  300. package/dist/namespaces/yt/generate/utils.cjs +5 -6
  301. package/dist/namespaces/yt/generate/utils.js +5 -6
  302. package/dist/namespaces/yt/parse/utils.cjs +5 -6
  303. package/dist/namespaces/yt/parse/utils.js +5 -6
  304. package/dist/node_modules/trousse/dist/coercions.cjs +25 -0
  305. package/dist/node_modules/trousse/dist/coercions.js +23 -0
  306. package/dist/node_modules/trousse/dist/is.cjs +31 -0
  307. package/dist/node_modules/trousse/dist/is.js +25 -0
  308. package/dist/opml/common/types.d.cts +11 -8
  309. package/dist/opml/common/types.d.ts +11 -8
  310. package/dist/opml/generate/config.cjs +3 -6
  311. package/dist/opml/generate/config.js +1 -3
  312. package/dist/opml/generate/index.cjs +7 -8
  313. package/dist/opml/generate/index.d.cts +3 -3
  314. package/dist/opml/generate/index.d.ts +3 -3
  315. package/dist/opml/generate/index.js +3 -4
  316. package/dist/opml/generate/utils.cjs +11 -9
  317. package/dist/opml/generate/utils.js +7 -8
  318. package/dist/opml/parse/config.cjs +14 -16
  319. package/dist/opml/parse/config.js +12 -15
  320. package/dist/opml/parse/index.cjs +13 -8
  321. package/dist/opml/parse/index.d.cts +2 -2
  322. package/dist/opml/parse/index.d.ts +2 -2
  323. package/dist/opml/parse/index.js +10 -5
  324. package/dist/opml/parse/utils.cjs +16 -14
  325. package/dist/opml/parse/utils.js +12 -13
  326. package/package.json +7 -6
@@ -9,15 +9,16 @@ type HasMarker<T> = [Extract<T, {
9
9
  type Optional<T> = { [K in keyof T]-?: object extends Pick<T, K> ? K : never }[keyof T];
10
10
  type Marked<T> = { [K in keyof T]-?: HasMarker<T[K]> extends true ? K : never }[keyof T];
11
11
  type Strict<T, S extends boolean> = Simplify<S extends true ? { [K in Exclude<keyof T, Optional<T>>]-?: Unwrap<T[K]> } & { [K in Optional<T>]?: Unwrap<T[K]> } : { [K in Exclude<keyof T, Optional<T> | Marked<T>>]-?: Unwrap<T[K]> } & { [K in Optional<T> | Marked<T>]?: Unwrap<T[K]> }>;
12
+ type IsPlainObject<T> = T extends Array<unknown> ? false : T extends ((...args: Array<unknown>) => unknown) ? false : T extends Date ? false : T extends object ? T extends null ? false : true : false;
13
+ type DeepOmit<T, K extends string> = T extends Array<infer U> ? Array<DeepOmit<U, K>> : IsPlainObject<T> extends true ? Pick<{ [P in keyof T]: DeepOmit<T[P], K> }, Exclude<keyof T, K>> : T;
12
14
  type Requirable<T> = T | {
13
15
  __requirable: T;
14
16
  };
15
17
  type DateLike = Date | string;
16
18
  type ExtraFields<F extends ReadonlyArray<string>, V = unknown> = { [K in F[number]]?: V };
17
- type IsPlainObject<T> = T extends Array<unknown> ? false : T extends ((...args: Array<unknown>) => unknown) ? false : T extends Date ? false : T extends object ? T extends null ? false : true : false;
18
- type DeepOmit<T, K extends string> = T extends Array<infer U> ? Array<DeepOmit<U, K>> : IsPlainObject<T> extends true ? Pick<{ [P in keyof T]: DeepOmit<T[P], K> }, Exclude<keyof T, K>> : T;
19
- type ParseOptions = {
19
+ type ParseMainOptions<TDate> = {
20
20
  maxItems?: number;
21
+ parseDateFn?: (raw: string) => TDate;
21
22
  };
22
23
  type XmlStylesheet = {
23
24
  type: string;
@@ -27,14 +28,14 @@ type XmlStylesheet = {
27
28
  charset?: string;
28
29
  alternate?: boolean;
29
30
  };
30
- type XmlGenerateOptions<O = Record<string, unknown>, S extends boolean = false> = O & {
31
+ type GenerateMainXmlOptions<O, S extends boolean> = O & {
31
32
  strict?: S;
32
33
  stylesheets?: Array<XmlStylesheet>;
33
34
  };
34
- type XmlGenerateMain<LV, SV, O = Record<string, unknown>> = <S extends boolean = false>(value: S extends true ? SV : LV, options?: XmlGenerateOptions<O, S>) => string;
35
- type JsonGenerateOptions<O = Record<string, unknown>, S extends boolean = false> = O & {
35
+ type GenerateMainXml<LV, SV, O = Record<string, unknown>> = <S extends boolean = false>(value: S extends true ? SV : LV, options?: GenerateMainXmlOptions<O, S>) => string;
36
+ type GenerateMainJsonOptions<O, S extends boolean> = O & {
36
37
  strict?: S;
37
38
  };
38
- type JsonGenerateMain<LV, SV, O = Record<string, unknown>> = <S extends boolean = false>(value: S extends true ? SV : LV, options?: JsonGenerateOptions<O, S>) => unknown;
39
+ type GenerateMainJson<LV, SV, O = Record<string, unknown>> = <S extends boolean = false>(value: S extends true ? SV : LV, options?: GenerateMainJsonOptions<O, S>) => unknown;
39
40
  //#endregion
40
- export { DateLike, DeepOmit, ExtraFields, JsonGenerateMain, ParseOptions, Requirable, Strict, XmlGenerateMain, XmlGenerateOptions, XmlStylesheet };
41
+ export { DateLike, DeepOmit, ExtraFields, GenerateMainJson, GenerateMainJsonOptions, GenerateMainXml, GenerateMainXmlOptions, IsPlainObject, ParseMainOptions, Requirable, Strict, XmlStylesheet };
@@ -9,15 +9,16 @@ type HasMarker<T> = [Extract<T, {
9
9
  type Optional<T> = { [K in keyof T]-?: object extends Pick<T, K> ? K : never }[keyof T];
10
10
  type Marked<T> = { [K in keyof T]-?: HasMarker<T[K]> extends true ? K : never }[keyof T];
11
11
  type Strict<T, S extends boolean> = Simplify<S extends true ? { [K in Exclude<keyof T, Optional<T>>]-?: Unwrap<T[K]> } & { [K in Optional<T>]?: Unwrap<T[K]> } : { [K in Exclude<keyof T, Optional<T> | Marked<T>>]-?: Unwrap<T[K]> } & { [K in Optional<T> | Marked<T>]?: Unwrap<T[K]> }>;
12
+ type IsPlainObject<T> = T extends Array<unknown> ? false : T extends ((...args: Array<unknown>) => unknown) ? false : T extends Date ? false : T extends object ? T extends null ? false : true : false;
13
+ type DeepOmit<T, K extends string> = T extends Array<infer U> ? Array<DeepOmit<U, K>> : IsPlainObject<T> extends true ? Pick<{ [P in keyof T]: DeepOmit<T[P], K> }, Exclude<keyof T, K>> : T;
12
14
  type Requirable<T> = T | {
13
15
  __requirable: T;
14
16
  };
15
17
  type DateLike = Date | string;
16
18
  type ExtraFields<F extends ReadonlyArray<string>, V = unknown> = { [K in F[number]]?: V };
17
- type IsPlainObject<T> = T extends Array<unknown> ? false : T extends ((...args: Array<unknown>) => unknown) ? false : T extends Date ? false : T extends object ? T extends null ? false : true : false;
18
- type DeepOmit<T, K extends string> = T extends Array<infer U> ? Array<DeepOmit<U, K>> : IsPlainObject<T> extends true ? Pick<{ [P in keyof T]: DeepOmit<T[P], K> }, Exclude<keyof T, K>> : T;
19
- type ParseOptions = {
19
+ type ParseMainOptions<TDate> = {
20
20
  maxItems?: number;
21
+ parseDateFn?: (raw: string) => TDate;
21
22
  };
22
23
  type XmlStylesheet = {
23
24
  type: string;
@@ -27,14 +28,14 @@ type XmlStylesheet = {
27
28
  charset?: string;
28
29
  alternate?: boolean;
29
30
  };
30
- type XmlGenerateOptions<O = Record<string, unknown>, S extends boolean = false> = O & {
31
+ type GenerateMainXmlOptions<O, S extends boolean> = O & {
31
32
  strict?: S;
32
33
  stylesheets?: Array<XmlStylesheet>;
33
34
  };
34
- type XmlGenerateMain<LV, SV, O = Record<string, unknown>> = <S extends boolean = false>(value: S extends true ? SV : LV, options?: XmlGenerateOptions<O, S>) => string;
35
- type JsonGenerateOptions<O = Record<string, unknown>, S extends boolean = false> = O & {
35
+ type GenerateMainXml<LV, SV, O = Record<string, unknown>> = <S extends boolean = false>(value: S extends true ? SV : LV, options?: GenerateMainXmlOptions<O, S>) => string;
36
+ type GenerateMainJsonOptions<O, S extends boolean> = O & {
36
37
  strict?: S;
37
38
  };
38
- type JsonGenerateMain<LV, SV, O = Record<string, unknown>> = <S extends boolean = false>(value: S extends true ? SV : LV, options?: JsonGenerateOptions<O, S>) => unknown;
39
+ type GenerateMainJson<LV, SV, O = Record<string, unknown>> = <S extends boolean = false>(value: S extends true ? SV : LV, options?: GenerateMainJsonOptions<O, S>) => unknown;
39
40
  //#endregion
40
- export { DateLike, DeepOmit, ExtraFields, JsonGenerateMain, ParseOptions, Requirable, Strict, XmlGenerateMain, XmlGenerateOptions, XmlStylesheet };
41
+ export { DateLike, DeepOmit, ExtraFields, GenerateMainJson, GenerateMainJsonOptions, GenerateMainXml, GenerateMainXmlOptions, IsPlainObject, ParseMainOptions, Requirable, Strict, XmlStylesheet };
@@ -1,39 +1,36 @@
1
+ const require_is = require("../node_modules/trousse/dist/is.cjs");
2
+ const require_coercions = require("../node_modules/trousse/dist/coercions.cjs");
1
3
  let entities = require("entities");
2
-
3
4
  //#region src/common/utils.ts
4
- const isPresent = (value) => {
5
- return value != null;
6
- };
7
- const isObject = (value) => {
8
- return value != null && typeof value === "object" && !Array.isArray(value) && value.constructor === Object;
9
- };
10
- const whitespaceOnlyRegex = /^\p{White_Space}*$/u;
11
- const isNonEmptyString = (value) => {
12
- return typeof value === "string" && value !== "" && !whitespaceOnlyRegex.test(value);
13
- };
14
5
  const isNonEmptyStringOrNumber = (value) => {
15
- return typeof value === "number" || isNonEmptyString(value);
6
+ return require_is.isNumber(value) || require_is.isNonEmptyString(value);
16
7
  };
17
8
  const retrieveText = (value) => {
18
9
  return value?.["#text"] ?? value;
19
10
  };
20
11
  const retrieveRdfResourceOrText = (value, parse) => {
21
- if (isObject(value)) {
12
+ if (require_is.isPlainObject(value)) {
22
13
  const rdfResource = parse(value["@rdf:resource"]);
23
- if (isPresent(rdfResource)) return rdfResource;
14
+ if (require_is.isPresent(rdfResource)) return rdfResource;
24
15
  const resource = parse(value["@resource"]);
25
- if (isPresent(resource)) return resource;
16
+ if (require_is.isPresent(resource)) return resource;
26
17
  }
27
18
  return parse(retrieveText(value));
28
19
  };
29
20
  const trimObject = (object) => {
30
- let result;
21
+ let hasPresent = false;
22
+ let hasAbsent = false;
23
+ for (const key in object) {
24
+ if (require_is.isPresent(object[key])) hasPresent = true;
25
+ else hasAbsent = true;
26
+ if (hasPresent && hasAbsent) break;
27
+ }
28
+ if (!hasPresent) return;
29
+ if (!hasAbsent) return object;
30
+ const result = {};
31
31
  for (const key in object) {
32
32
  const value = object[key];
33
- if (isPresent(value)) {
34
- if (!result) result = {};
35
- result[key] = value;
36
- }
33
+ if (require_is.isPresent(value)) result[key] = value;
37
34
  }
38
35
  return result;
39
36
  };
@@ -41,78 +38,94 @@ const trimArray = (value, parse) => {
41
38
  if (!Array.isArray(value) || value.length === 0) return;
42
39
  if (!parse) {
43
40
  let needsTrimming = false;
44
- for (let i = 0; i < value.length; i++) if (!isPresent(value[i])) {
41
+ for (const item of value) if (!require_is.isPresent(item)) {
45
42
  needsTrimming = true;
46
43
  break;
47
44
  }
48
45
  if (!needsTrimming) return value;
49
46
  }
50
47
  const result = [];
51
- for (let i = 0; i < value.length; i++) {
52
- const item = parse ? parse(value[i]) : value[i];
53
- if (isPresent(item)) result.push(item);
48
+ for (const element of value) {
49
+ const item = parse ? parse(element) : element;
50
+ if (require_is.isPresent(item)) result.push(item);
54
51
  }
55
52
  return result.length > 0 ? result : void 0;
56
53
  };
57
54
  const cdataStartTag = "<![CDATA[";
58
55
  const cdataEndTag = "]]>";
56
+ const commentStartTag = "<!--";
57
+ const commentEndTag = "-->";
59
58
  const hasEntities = (text) => {
60
59
  const ampIndex = text.indexOf("&");
61
60
  return ampIndex !== -1 && text.indexOf(";", ampIndex) !== -1;
62
61
  };
62
+ const stripComments = (text) => {
63
+ let currentIndex = text.indexOf(commentStartTag);
64
+ if (currentIndex === -1) return text;
65
+ let result = "";
66
+ let lastIndex = 0;
67
+ while (currentIndex !== -1) {
68
+ result += text.slice(lastIndex, currentIndex);
69
+ const endIndex = text.indexOf(commentEndTag, currentIndex + 4);
70
+ if (endIndex === -1) return text;
71
+ lastIndex = endIndex + 3;
72
+ currentIndex = text.indexOf(commentStartTag, lastIndex);
73
+ }
74
+ result += text.slice(lastIndex);
75
+ return result;
76
+ };
63
77
  const decodeWithCdata = (text) => {
64
78
  let currentIndex = text.indexOf(cdataStartTag);
65
79
  if (currentIndex === -1) return hasEntities(text) ? (0, entities.decodeHTML)(text) : text;
66
80
  let result = "";
67
81
  let lastIndex = 0;
68
82
  while (currentIndex !== -1) {
69
- const textBefore = text.substring(lastIndex, currentIndex);
83
+ const textBefore = text.slice(lastIndex, currentIndex);
70
84
  result += hasEntities(textBefore) ? (0, entities.decodeHTML)(textBefore) : textBefore;
71
85
  const endIndex = text.indexOf(cdataEndTag, currentIndex + 9);
72
86
  if (endIndex === -1) return hasEntities(text) ? (0, entities.decodeHTML)(text) : text;
73
- result += text.substring(currentIndex + 9, endIndex);
87
+ result += text.slice(currentIndex + 9, endIndex);
74
88
  lastIndex = endIndex + 3;
75
89
  currentIndex = text.indexOf(cdataStartTag, lastIndex);
76
90
  }
77
- const textAfter = text.substring(lastIndex);
91
+ const textAfter = text.slice(lastIndex);
78
92
  result += hasEntities(textAfter) ? (0, entities.decodeHTML)(textAfter) : textAfter;
79
93
  return result;
80
94
  };
81
95
  const parseString = (value) => {
82
96
  if (typeof value === "string") {
83
97
  if (value === "") return;
84
- return decodeWithCdata(value).trim() || void 0;
98
+ return decodeWithCdata(stripComments(value)).trim() || void 0;
85
99
  }
86
100
  if (typeof value === "number") return value.toString();
87
101
  };
88
- const parseNumber = (value) => {
89
- if (typeof value === "number") return value;
90
- if (isNonEmptyString(value)) {
91
- const numeric = +value;
92
- return Number.isNaN(numeric) ? void 0 : numeric;
102
+ const parseJsonString = (value) => {
103
+ if (typeof value === "string") {
104
+ if (value === "") return;
105
+ return value.trim() || void 0;
93
106
  }
107
+ if (typeof value === "number") return value.toString();
108
+ };
109
+ const parseNumber = (value) => {
110
+ return require_coercions.coerceNumber(value);
94
111
  };
95
- const trueRegex = /^\p{White_Space}*true\p{White_Space}*$/iu;
96
- const falseRegex = /^\p{White_Space}*false\p{White_Space}*$/iu;
97
112
  const yesRegex = /^\p{White_Space}*yes\p{White_Space}*$/iu;
98
113
  const parseBoolean = (value) => {
99
- if (typeof value === "boolean") return value;
100
- if (isNonEmptyString(value)) {
101
- if (trueRegex.test(value)) return true;
102
- if (falseRegex.test(value)) return false;
103
- }
114
+ return require_coercions.coerceBoolean(value);
104
115
  };
105
116
  const parseYesNoBoolean = (value) => {
106
117
  const boolean = parseBoolean(value);
107
118
  if (boolean !== void 0) return boolean;
108
- if (isNonEmptyString(value)) return yesRegex.test(value);
119
+ if (require_is.isNonEmptyString(value)) return yesRegex.test(value);
109
120
  };
110
- const parseDate = (value) => {
111
- return parseString(value);
121
+ const parseDate = (value, parseDateFn) => {
122
+ const raw = parseString(value);
123
+ if (raw === void 0) return;
124
+ return parseDateFn ? parseDateFn(raw) : raw;
112
125
  };
113
126
  const parseArray = (value) => {
114
127
  if (Array.isArray(value)) return value;
115
- if (!isObject(value)) return;
128
+ if (!require_is.isPlainObject(value)) return;
116
129
  if (value.length) return Array.from(value);
117
130
  const keys = Object.keys(value);
118
131
  if (keys.length === 0) return;
@@ -125,7 +138,7 @@ const parseArray = (value) => {
125
138
  };
126
139
  const parseArrayOf = (value, parse, limit) => {
127
140
  let array = parseArray(value);
128
- if (!array && isPresent(value)) array = [value];
141
+ if (!array && require_is.isPresent(value)) array = [value];
129
142
  if (array) return trimArray(limitArray(array, limit), parse);
130
143
  };
131
144
  const limitArray = (array, limit) => {
@@ -134,7 +147,7 @@ const limitArray = (array, limit) => {
134
147
  return array.slice(0, limit);
135
148
  };
136
149
  const parseSingular = (value) => {
137
- return Array.isArray(value) ? value[0] : value;
150
+ return require_coercions.coerceSingular(value);
138
151
  };
139
152
  const parseSingularOf = (value, parse) => {
140
153
  return parse(parseSingular(value));
@@ -176,17 +189,17 @@ const generateXml = (builder, value, options) => {
176
189
  return `${declaration}\n${body}`;
177
190
  };
178
191
  const generateRfc822Date = (value) => {
179
- if (!isPresent(value)) return;
192
+ if (!require_is.isPresent(value)) return;
180
193
  const isString = typeof value === "string";
181
- if (isString && !isNonEmptyString(value)) return;
194
+ if (isString && !require_is.isNonEmptyString(value)) return;
182
195
  const date = isString ? new Date(value) : value;
183
196
  if (!Number.isNaN(date.getTime())) return date.toUTCString();
184
197
  if (isString) return value;
185
198
  };
186
199
  const generateRfc3339Date = (value) => {
187
- if (!isPresent(value)) return;
200
+ if (!require_is.isPresent(value)) return;
188
201
  const isString = typeof value === "string";
189
- if (isString && !isNonEmptyString(value)) return;
202
+ if (isString && !require_is.isNonEmptyString(value)) return;
190
203
  const date = isString ? new Date(value) : value;
191
204
  if (!Number.isNaN(date.getTime())) return date.toISOString();
192
205
  if (isString) return value;
@@ -206,7 +219,7 @@ const detectNamespaces = (value, recursive = false) => {
206
219
  for (const item of current) traverse(item);
207
220
  return;
208
221
  }
209
- if (isObject(current)) for (const key in current) {
222
+ if (require_is.isPlainObject(current)) for (const key in current) {
210
223
  if (seenKeys?.has(key)) continue;
211
224
  seenKeys?.add(key);
212
225
  const keyWithoutAt = key.charCodeAt(0) === 64 ? key.slice(1) : key;
@@ -220,17 +233,17 @@ const detectNamespaces = (value, recursive = false) => {
220
233
  };
221
234
  const cdataSpecialCharsRegex = /[<>&]|]]>/;
222
235
  const generateCdataString = (value) => {
223
- if (!isNonEmptyString(value)) return;
236
+ if (!require_is.isNonEmptyString(value)) return;
224
237
  if (cdataSpecialCharsRegex.test(value)) return { "#cdata": value.trim() };
225
238
  return value.trim();
226
239
  };
227
240
  const generateTextOrCdataString = (value) => {
228
241
  const result = generateCdataString(value);
229
- if (!result || isObject(result)) return result;
242
+ if (!result || require_is.isPlainObject(result)) return result;
230
243
  return { "#text": result };
231
244
  };
232
245
  const generatePlainString = (value) => {
233
- if (!isNonEmptyString(value)) return;
246
+ if (!require_is.isNonEmptyString(value)) return;
234
247
  return value.trim();
235
248
  };
236
249
  const generateNumber = (value) => {
@@ -238,11 +251,11 @@ const generateNumber = (value) => {
238
251
  };
239
252
  const generateRdfResource = (value, generate) => {
240
253
  const rdfResource = generate(value);
241
- if (!isPresent(rdfResource)) return;
254
+ if (!require_is.isPresent(rdfResource)) return;
242
255
  return { "@rdf:resource": rdfResource };
243
256
  };
244
257
  const generateNamespaceAttrs = (value, namespaceUris) => {
245
- if (!isObject(value)) return;
258
+ if (!require_is.isPlainObject(value)) return;
246
259
  let namespaceAttrs;
247
260
  const valueNamespaces = detectNamespaces(value, true);
248
261
  for (const prefix in namespaceUris) {
@@ -252,7 +265,7 @@ const generateNamespaceAttrs = (value, namespaceUris) => {
252
265
  }
253
266
  return namespaceAttrs;
254
267
  };
255
- const createNamespaceNormalizator = (namespaceUris, namespacePrefixes, primaryNamespace) => {
268
+ const createNamespaceNormalizator = (namespaceUris, namespacePrefixes, primaryNamespaces) => {
256
269
  const normalizedUriCache = /* @__PURE__ */ new Map();
257
270
  const normalizeNamespaceUri = (uri) => {
258
271
  if (typeof uri !== "string") return uri;
@@ -263,7 +276,7 @@ const createNamespaceNormalizator = (namespaceUris, namespacePrefixes, primaryNa
263
276
  }
264
277
  return normalized;
265
278
  };
266
- const primaryNamespaceUris = primaryNamespace && namespaceUris[primaryNamespace] ? namespaceUris[primaryNamespace].map(normalizeNamespaceUri) : void 0;
279
+ const primaryNamespaceUris = primaryNamespaces?.length ? primaryNamespaces.flatMap((key) => namespaceUris[key].map(normalizeNamespaceUri)) : void 0;
267
280
  const resolveNamespacePrefix = (uri, localName, fallback) => {
268
281
  const normalizedUri = normalizeNamespaceUri(uri);
269
282
  if (primaryNamespaceUris?.includes(normalizedUri)) return localName;
@@ -273,10 +286,10 @@ const createNamespaceNormalizator = (namespaceUris, namespacePrefixes, primaryNa
273
286
  };
274
287
  const extractNamespaceDeclarations = (element) => {
275
288
  const declarations = {};
276
- if (isObject(element)) {
289
+ if (require_is.isPlainObject(element)) {
277
290
  for (const key in element) if (key === "@xmlns") declarations[""] = normalizeNamespaceUri(element[key]);
278
291
  else if (key.indexOf("@xmlns:") === 0) {
279
- const prefix = key.substring(7);
292
+ const prefix = key.slice(7);
280
293
  declarations[prefix] = normalizeNamespaceUri(element[key]);
281
294
  }
282
295
  }
@@ -288,19 +301,22 @@ const createNamespaceNormalizator = (namespaceUris, namespacePrefixes, primaryNa
288
301
  if (useDefault && context[""]) return resolveNamespacePrefix(context[""], name, name);
289
302
  return name;
290
303
  }
291
- const prefix = name.substring(0, colonIndex);
292
- const unprefixedName = name.substring(colonIndex + 1);
304
+ const prefix = name.slice(0, colonIndex);
305
+ const unprefixedName = name.slice(colonIndex + 1);
293
306
  const uri = context[prefix];
294
307
  if (uri) return resolveNamespacePrefix(uri, unprefixedName, name);
295
308
  return name;
296
309
  };
297
310
  const normalizeKey = (key, context) => {
298
- if (key.charCodeAt(0) === 64) return `@${normalizeWithContext(key.substring(1), context, false)}`;
311
+ if (key.charCodeAt(0) === 64) {
312
+ const attrName = key.slice(1);
313
+ return `@${normalizeWithContext(attrName, context, false)}`;
314
+ }
299
315
  return normalizeWithContext(key, context, true);
300
316
  };
301
317
  const traverseAndNormalize = (object, parentContext = {}) => {
302
318
  if (Array.isArray(object)) return object.map((item) => traverseAndNormalize(item, parentContext));
303
- if (!isObject(object)) return object;
319
+ if (!require_is.isPlainObject(object)) return object;
304
320
  const declarations = extractNamespaceDeclarations(object);
305
321
  let hasDeclarations = false;
306
322
  for (const _ in declarations) {
@@ -328,9 +344,40 @@ const createNamespaceNormalizator = (namespaceUris, namespacePrefixes, primaryNa
328
344
  }
329
345
  return normalizedObject;
330
346
  };
347
+ const needsNormalization = (object) => {
348
+ const check = (value) => {
349
+ if (Array.isArray(value)) {
350
+ for (const item of value) if (check(item)) return true;
351
+ return false;
352
+ }
353
+ if (!require_is.isPlainObject(value)) return false;
354
+ for (const key in value) {
355
+ if (key[0] === "@") {
356
+ if (key === "@xmlns") {
357
+ const normalizedUri = normalizeNamespaceUri(value[key]);
358
+ if (primaryNamespaceUris?.includes(normalizedUri)) continue;
359
+ if (namespacePrefixes[normalizedUri]) return true;
360
+ } else if (key.startsWith("@xmlns:")) {
361
+ const prefix = key.slice(7);
362
+ const normalizedUri = normalizeNamespaceUri(value[key]);
363
+ const standardPrefix = namespacePrefixes[normalizedUri];
364
+ if (standardPrefix) {
365
+ if (primaryNamespaceUris?.includes(normalizedUri)) return true;
366
+ if (standardPrefix !== prefix) return true;
367
+ }
368
+ }
369
+ continue;
370
+ }
371
+ if (key[0] === "#") continue;
372
+ if (check(value[key])) return true;
373
+ }
374
+ return false;
375
+ };
376
+ return check(object);
377
+ };
331
378
  const normalizeRoot = (object) => {
332
- if (!isObject(object)) return object;
333
- if (Array.isArray(object)) return object.map(normalizeRoot);
379
+ if (!require_is.isPlainObject(object)) return object;
380
+ if (!needsNormalization(object)) return object;
334
381
  const normalizedObject = {};
335
382
  for (const key in object) {
336
383
  const value = object[key];
@@ -342,20 +389,42 @@ const createNamespaceNormalizator = (namespaceUris, namespacePrefixes, primaryNa
342
389
  };
343
390
  return normalizeRoot;
344
391
  };
392
+ const startsWithBraceRegex = /^\s*\{/;
393
+ const endsWithBraceRegex = /\}\s*$/;
345
394
  const parseJsonObject = (value) => {
346
- if (isObject(value)) return value;
347
- if (!isNonEmptyString(value) || value.length < 2) return;
348
- const startsWithBrace = value.charAt(0) === "{" || /^\s*\{/.test(value);
349
- const endsWithBrace = value.charAt(value.length - 1) === "}" || /\}\s*$/.test(value);
395
+ if (require_is.isPlainObject(value)) return value;
396
+ if (!require_is.isNonEmptyString(value) || value.length < 2) return;
397
+ const startsWithBrace = value.charAt(0) === "{" || startsWithBraceRegex.test(value);
398
+ const endsWithBrace = value.charAt(value.length - 1) === "}" || endsWithBraceRegex.test(value);
350
399
  if (!startsWithBrace || !endsWithBrace) return;
351
400
  try {
352
401
  return JSON.parse(value);
353
402
  } catch {}
354
403
  };
355
-
404
+ const namespaceContainers = [
405
+ "media:group",
406
+ "media:content",
407
+ "media:group.media:content",
408
+ "media:embed",
409
+ "podcast:liveitem",
410
+ "itunes:owner"
411
+ ];
412
+ const expandStopNodes = (stopNodes, feedContainerPaths) => {
413
+ const set = /* @__PURE__ */ new Set();
414
+ for (const node of stopNodes) {
415
+ const suffix = node.slice(2);
416
+ const prefix = suffix.split(":")[0];
417
+ for (const feedPath of feedContainerPaths) {
418
+ set.add(`${feedPath}.${suffix}`);
419
+ for (const nsContainer of namespaceContainers) if (nsContainer.split(":")[0] === prefix) set.add(`${feedPath}.${nsContainer}.${suffix}`);
420
+ }
421
+ }
422
+ return [...set];
423
+ };
356
424
  //#endregion
357
425
  exports.createNamespaceNormalizator = createNamespaceNormalizator;
358
426
  exports.detectNamespaces = detectNamespaces;
427
+ exports.expandStopNodes = expandStopNodes;
359
428
  exports.generateBoolean = generateBoolean;
360
429
  exports.generateCdataString = generateCdataString;
361
430
  exports.generateCsvOf = generateCsvOf;
@@ -367,16 +436,18 @@ exports.generateRfc3339Date = generateRfc3339Date;
367
436
  exports.generateRfc822Date = generateRfc822Date;
368
437
  exports.generateTextOrCdataString = generateTextOrCdataString;
369
438
  exports.generateXml = generateXml;
439
+ exports.generateXmlStylesheet = generateXmlStylesheet;
370
440
  exports.generateYesNoBoolean = generateYesNoBoolean;
371
- exports.isNonEmptyString = isNonEmptyString;
441
+ exports.hasEntities = hasEntities;
372
442
  exports.isNonEmptyStringOrNumber = isNonEmptyStringOrNumber;
373
- exports.isObject = isObject;
374
- exports.isPresent = isPresent;
443
+ exports.limitArray = limitArray;
444
+ exports.parseArray = parseArray;
375
445
  exports.parseArrayOf = parseArrayOf;
376
446
  exports.parseBoolean = parseBoolean;
377
447
  exports.parseCsvOf = parseCsvOf;
378
448
  exports.parseDate = parseDate;
379
449
  exports.parseJsonObject = parseJsonObject;
450
+ exports.parseJsonString = parseJsonString;
380
451
  exports.parseNumber = parseNumber;
381
452
  exports.parseSingular = parseSingular;
382
453
  exports.parseSingularOf = parseSingularOf;
@@ -385,4 +456,4 @@ exports.parseYesNoBoolean = parseYesNoBoolean;
385
456
  exports.retrieveRdfResourceOrText = retrieveRdfResourceOrText;
386
457
  exports.retrieveText = retrieveText;
387
458
  exports.trimArray = trimArray;
388
- exports.trimObject = trimObject;
459
+ exports.trimObject = trimObject;