@splendidlabz/utils 1.11.3 → 1.11.4

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 (408) hide show
  1. package/dist/cjs/dom/accessibility.cjs +53 -0
  2. package/dist/cjs/dom/actions/index.cjs +410 -0
  3. package/dist/cjs/dom/actions/masonry.cjs +152 -0
  4. package/dist/cjs/dom/actions/prefer-horizontal-scroll.cjs +157 -0
  5. package/dist/cjs/dom/actions/sticky.cjs +213 -0
  6. package/dist/cjs/dom/bounding-box.cjs +70 -0
  7. package/dist/cjs/dom/clipboard.cjs +37 -0
  8. package/dist/cjs/dom/cookie.cjs +57 -0
  9. package/dist/cjs/dom/css-vars.cjs +57 -0
  10. package/dist/cjs/dom/events.cjs +59 -0
  11. package/{src/dom/focusable.js → dist/cjs/dom/focusable.cjs} +51 -73
  12. package/dist/cjs/dom/font-size.cjs +80 -0
  13. package/dist/cjs/dom/get-element.cjs +98 -0
  14. package/dist/cjs/dom/hash.cjs +35 -0
  15. package/dist/cjs/dom/index.cjs +1267 -0
  16. package/dist/cjs/dom/keyboard.cjs +51 -0
  17. package/dist/cjs/dom/local-store.cjs +79 -0
  18. package/dist/cjs/dom/media.cjs +59 -0
  19. package/dist/cjs/dom/observers/index.cjs +253 -0
  20. package/dist/cjs/dom/observers/intersection-observer.cjs +91 -0
  21. package/dist/cjs/dom/observers/mutation-observer.cjs +95 -0
  22. package/dist/cjs/dom/observers/observer.cjs +48 -0
  23. package/dist/cjs/dom/observers/resize-observer.cjs +84 -0
  24. package/dist/cjs/dom/observers/scroll-observer.cjs +177 -0
  25. package/dist/cjs/dom/pkce.cjs +53 -0
  26. package/dist/cjs/dom/query-params.cjs +38 -0
  27. package/dist/cjs/dom/random-string.cjs +38 -0
  28. package/dist/cjs/dom/sanitize.cjs +65 -0
  29. package/dist/cjs/dom/session-store.cjs +49 -0
  30. package/dist/cjs/dom/spam-prevention.cjs +50 -0
  31. package/dist/cjs/dom/trap-focus.cjs +197 -0
  32. package/dist/cjs/dom/ui/aria-current.cjs +43 -0
  33. package/dist/cjs/dom/ui/inconsistent-button-fix.cjs +35 -0
  34. package/dist/cjs/dom/ui/index.cjs +105 -0
  35. package/dist/cjs/dom/ui/scroll-container.cjs +47 -0
  36. package/dist/cjs/dom/ui/traverse-and-scramble.cjs +50 -0
  37. package/dist/cjs/lib/arrays/index.cjs +139 -0
  38. package/dist/cjs/lib/arrays/item-position.cjs +42 -0
  39. package/dist/cjs/lib/arrays/join.cjs +43 -0
  40. package/dist/cjs/lib/arrays/shuffle.cjs +42 -0
  41. package/dist/cjs/lib/arrays/sort.cjs +67 -0
  42. package/dist/cjs/lib/arrays/split-array.cjs +41 -0
  43. package/dist/cjs/lib/arrays/unique.cjs +31 -0
  44. package/dist/cjs/lib/auth/index.cjs +53 -0
  45. package/dist/cjs/lib/auth/route-manager.cjs +51 -0
  46. package/dist/cjs/lib/checks.cjs +63 -0
  47. package/dist/cjs/lib/date/days.cjs +37 -0
  48. package/dist/cjs/lib/date/index.cjs +208 -0
  49. package/dist/cjs/lib/date/months.cjs +102 -0
  50. package/dist/cjs/lib/date/time.cjs +117 -0
  51. package/dist/cjs/lib/form/form-data.cjs +83 -0
  52. package/dist/cjs/lib/form/index.cjs +122 -0
  53. package/dist/cjs/lib/form/sanitize.cjs +61 -0
  54. package/dist/cjs/lib/functions/callback.cjs +31 -0
  55. package/dist/cjs/lib/functions/debounce.cjs +43 -0
  56. package/dist/cjs/lib/functions/env.cjs +32 -0
  57. package/dist/cjs/lib/functions/functional.cjs +82 -0
  58. package/dist/cjs/lib/functions/index.cjs +142 -0
  59. package/dist/cjs/lib/functions/throttle.cjs +38 -0
  60. package/dist/cjs/lib/functions/timeout.cjs +41 -0
  61. package/dist/cjs/lib/hash.cjs +43 -0
  62. package/dist/cjs/lib/index.cjs +1178 -0
  63. package/dist/cjs/lib/numbers/index.cjs +49 -0
  64. package/dist/cjs/lib/numbers/math.cjs +36 -0
  65. package/dist/cjs/lib/objects/camelcase-keys.cjs +80 -0
  66. package/dist/cjs/lib/objects/empty.cjs +39 -0
  67. package/dist/cjs/lib/objects/equal.cjs +47 -0
  68. package/dist/cjs/lib/objects/extend.cjs +147 -0
  69. package/dist/cjs/lib/objects/flatten.cjs +48 -0
  70. package/dist/cjs/lib/objects/index.cjs +378 -0
  71. package/dist/cjs/lib/objects/json.cjs +35 -0
  72. package/dist/cjs/lib/objects/loop.cjs +40 -0
  73. package/dist/cjs/lib/objects/mix/mix.cjs +115 -0
  74. package/dist/cjs/lib/objects/nested-property.cjs +45 -0
  75. package/dist/cjs/lib/objects/normalize-object.cjs +106 -0
  76. package/dist/cjs/lib/objects/omit-empty.cjs +40 -0
  77. package/dist/cjs/lib/objects/size.cjs +63 -0
  78. package/dist/cjs/lib/objects/split.cjs +39 -0
  79. package/dist/cjs/lib/promises/index.cjs +69 -0
  80. package/dist/cjs/lib/promises/reject.cjs +67 -0
  81. package/dist/cjs/lib/sse.cjs +99 -0
  82. package/dist/cjs/lib/strings/convert-case/convert-case.cjs +96 -0
  83. package/dist/cjs/lib/strings/index.cjs +197 -0
  84. package/dist/cjs/lib/strings/markdown.cjs +76 -0
  85. package/dist/cjs/lib/strings/name.cjs +46 -0
  86. package/dist/cjs/lib/strings/pluralize.cjs +40 -0
  87. package/dist/cjs/lib/strings/query-string.cjs +43 -0
  88. package/dist/cjs/lib/style/index.cjs +64 -0
  89. package/dist/cjs/lib/symbols/index.cjs +40 -0
  90. package/dist/cjs/lib/symbols/symbols.cjs +38 -0
  91. package/dist/cjs/node/dirname.cjs +49 -0
  92. package/dist/cjs/node/file-cache.cjs +200 -0
  93. package/dist/cjs/node/file.cjs +50 -0
  94. package/dist/cjs/node/hash.cjs +42 -0
  95. package/dist/cjs/node/index.cjs +296 -0
  96. package/dist/cjs/node/pkce.cjs +64 -0
  97. package/dist/cjs/node/random-string.cjs +43 -0
  98. package/dist/cjs/node/sanitize.cjs +65 -0
  99. package/dist/cjs/node/uuid.cjs +42 -0
  100. package/dist/esm/dom/accessibility.js +26 -0
  101. package/dist/esm/dom/actions/index.js +3 -0
  102. package/dist/esm/dom/actions/masonry.js +38 -0
  103. package/dist/esm/dom/actions/prefer-horizontal-scroll.js +90 -0
  104. package/dist/esm/dom/actions/sticky.js +70 -0
  105. package/dist/esm/dom/bounding-box.js +44 -0
  106. package/dist/esm/dom/clipboard.js +12 -0
  107. package/dist/esm/dom/cookie.js +31 -0
  108. package/dist/esm/dom/css-vars.js +21 -0
  109. package/dist/esm/dom/events.js +31 -0
  110. package/dist/esm/dom/focusable.js +117 -0
  111. package/dist/esm/dom/font-size.js +40 -0
  112. package/dist/esm/dom/get-element.js +66 -0
  113. package/dist/esm/dom/hash.js +10 -0
  114. package/dist/esm/dom/index.js +23 -0
  115. package/dist/esm/dom/keyboard.js +22 -0
  116. package/{src → dist/esm}/dom/local-store.js +16 -28
  117. package/dist/esm/dom/media.js +32 -0
  118. package/dist/esm/dom/observers/index.js +4 -0
  119. package/dist/esm/dom/observers/intersection-observer.js +36 -0
  120. package/dist/esm/dom/observers/mutation-observer.js +40 -0
  121. package/dist/esm/dom/observers/observer.js +15 -0
  122. package/dist/esm/dom/observers/resize-observer.js +29 -0
  123. package/dist/esm/dom/observers/scroll-observer.js +95 -0
  124. package/dist/esm/dom/pkce.js +20 -0
  125. package/dist/esm/dom/query-params.js +13 -0
  126. package/dist/esm/dom/random-string.js +12 -0
  127. package/dist/esm/dom/sanitize.js +8 -0
  128. package/dist/esm/dom/session-store.js +24 -0
  129. package/dist/esm/dom/spam-prevention.js +25 -0
  130. package/dist/esm/dom/trap-focus.js +51 -0
  131. package/dist/esm/dom/ui/aria-current.js +17 -0
  132. package/dist/esm/dom/ui/inconsistent-button-fix.js +10 -0
  133. package/dist/esm/dom/ui/index.js +4 -0
  134. package/dist/esm/dom/ui/scroll-container.js +22 -0
  135. package/dist/esm/dom/ui/traverse-and-scramble.js +25 -0
  136. package/dist/esm/lib/arrays/index.js +6 -0
  137. package/dist/esm/lib/arrays/item-position.js +15 -0
  138. package/dist/esm/lib/arrays/join.js +12 -0
  139. package/dist/esm/lib/arrays/shuffle.js +17 -0
  140. package/dist/esm/lib/arrays/sort.js +36 -0
  141. package/dist/esm/lib/arrays/split-array.js +16 -0
  142. package/dist/esm/lib/arrays/unique.js +6 -0
  143. package/dist/esm/lib/auth/index.js +1 -0
  144. package/dist/esm/lib/auth/route-manager.js +25 -0
  145. package/dist/esm/lib/checks.js +34 -0
  146. package/dist/esm/lib/date/days.js +12 -0
  147. package/dist/esm/lib/date/index.js +3 -0
  148. package/dist/esm/lib/date/months.js +77 -0
  149. package/dist/esm/lib/date/time.js +75 -0
  150. package/dist/esm/lib/form/form-data.js +57 -0
  151. package/dist/esm/lib/form/index.js +2 -0
  152. package/dist/esm/lib/form/sanitize.js +34 -0
  153. package/dist/esm/lib/functions/callback.js +6 -0
  154. package/dist/esm/lib/functions/debounce.js +18 -0
  155. package/dist/esm/lib/functions/env.js +7 -0
  156. package/dist/esm/lib/functions/functional.js +52 -0
  157. package/dist/esm/lib/functions/index.js +5 -0
  158. package/dist/esm/lib/functions/throttle.js +13 -0
  159. package/dist/esm/lib/functions/timeout.js +14 -0
  160. package/dist/esm/lib/hash.js +18 -0
  161. package/dist/esm/lib/index.js +14 -0
  162. package/dist/esm/lib/numbers/index.js +11 -0
  163. package/dist/esm/lib/numbers/math.js +10 -0
  164. package/dist/esm/lib/objects/camelcase-keys.js +16 -0
  165. package/dist/esm/lib/objects/empty.js +13 -0
  166. package/dist/esm/lib/objects/equal.js +11 -0
  167. package/dist/esm/lib/objects/extend.js +13 -0
  168. package/dist/esm/lib/objects/flatten.js +17 -0
  169. package/dist/esm/lib/objects/index.js +13 -0
  170. package/dist/esm/lib/objects/json.js +10 -0
  171. package/dist/esm/lib/objects/loop.js +14 -0
  172. package/dist/esm/lib/objects/mix/mix.js +88 -0
  173. package/dist/esm/lib/objects/nested-property.js +18 -0
  174. package/dist/esm/lib/objects/normalize-object.js +9 -0
  175. package/dist/esm/lib/objects/omit-empty.js +15 -0
  176. package/dist/esm/lib/objects/size.js +38 -0
  177. package/dist/esm/lib/objects/split.js +14 -0
  178. package/dist/esm/lib/promises/index.js +1 -0
  179. package/dist/esm/lib/promises/reject.js +17 -0
  180. package/dist/esm/lib/sse.js +50 -0
  181. package/dist/esm/lib/strings/convert-case/convert-case.js +64 -0
  182. package/dist/esm/lib/strings/index.js +5 -0
  183. package/dist/esm/lib/strings/markdown.js +40 -0
  184. package/dist/esm/lib/strings/name.js +21 -0
  185. package/dist/esm/lib/strings/pluralize.js +5 -0
  186. package/dist/esm/lib/strings/query-string.js +16 -0
  187. package/dist/esm/lib/style/index.js +12 -0
  188. package/dist/esm/lib/symbols/index.js +1 -0
  189. package/dist/esm/lib/symbols/symbols.js +12 -0
  190. package/dist/esm/node/context.js +0 -0
  191. package/dist/esm/node/dirname.js +13 -0
  192. package/dist/esm/node/file-cache.js +121 -0
  193. package/dist/esm/node/file.js +14 -0
  194. package/dist/esm/node/hash.js +7 -0
  195. package/dist/esm/node/index.js +7 -0
  196. package/dist/esm/node/pkce.js +20 -0
  197. package/dist/esm/node/random-string.js +8 -0
  198. package/dist/esm/node/sanitize.js +8 -0
  199. package/dist/esm/node/uuid.js +7 -0
  200. package/dist/types/dom/accessibility.d.cts +30 -0
  201. package/dist/types/dom/actions/index.d.cts +3 -0
  202. package/dist/types/dom/actions/masonry.d.cts +5 -0
  203. package/dist/types/dom/actions/prefer-horizontal-scroll.d.cts +5 -0
  204. package/dist/types/dom/actions/sticky.d.cts +5 -0
  205. package/{src/dom/bounding-box.js → dist/types/dom/bounding-box.d.cts} +8 -49
  206. package/dist/types/dom/clipboard.d.cts +7 -0
  207. package/dist/types/dom/cookie.d.cts +7 -0
  208. package/dist/types/dom/css-vars.d.cts +6 -0
  209. package/{src/dom/events.js → dist/types/dom/events.d.cts} +52 -31
  210. package/dist/types/dom/focusable.d.cts +78 -0
  211. package/dist/types/dom/font-size.d.cts +8 -0
  212. package/{src/dom/get-element.js → dist/types/dom/get-element.d.cts} +25 -99
  213. package/dist/types/dom/hash.d.cts +3 -0
  214. package/dist/types/dom/index.d.cts +31 -0
  215. package/{src/dom/keyboard.js → dist/types/dom/keyboard.d.cts} +7 -19
  216. package/dist/types/dom/local-store.d.cts +31 -0
  217. package/dist/types/dom/media.d.cts +5 -0
  218. package/dist/types/dom/observers/index.d.cts +4 -0
  219. package/dist/types/dom/observers/intersection-observer.d.cts +10 -0
  220. package/dist/types/dom/observers/mutation-observer.d.cts +9 -0
  221. package/dist/types/dom/observers/observer.d.cts +3 -0
  222. package/{src/dom/observers/resize-observer.js → dist/types/dom/observers/resize-observer.d.cts} +6 -32
  223. package/dist/types/dom/observers/scroll-observer.d.cts +40 -0
  224. package/dist/types/dom/pkce.d.cts +8 -0
  225. package/dist/types/dom/query-params.d.cts +6 -0
  226. package/dist/types/dom/random-string.d.cts +9 -0
  227. package/dist/types/dom/sanitize.d.cts +10 -0
  228. package/dist/types/dom/session-store.d.cts +7 -0
  229. package/dist/types/dom/spam-prevention.d.cts +14 -0
  230. package/dist/types/dom/trap-focus.d.cts +32 -0
  231. package/dist/types/dom/ui/aria-current.d.cts +7 -0
  232. package/{src/dom/ui/inconsistent-button-fix.js → dist/types/dom/ui/inconsistent-button-fix.d.cts} +5 -11
  233. package/dist/types/dom/ui/index.d.cts +4 -0
  234. package/dist/types/dom/ui/scroll-container.d.cts +3 -0
  235. package/dist/types/dom/ui/traverse-and-scramble.d.cts +21 -0
  236. package/dist/types/lib/arrays/index.d.cts +6 -0
  237. package/{src/lib/arrays/item-position.js → dist/types/lib/arrays/item-position.d.cts} +5 -12
  238. package/{src/lib/arrays/join.js → dist/types/lib/arrays/join.d.cts} +4 -9
  239. package/dist/types/lib/arrays/shuffle.d.cts +3 -0
  240. package/dist/types/lib/arrays/sort.d.cts +32 -0
  241. package/dist/types/lib/arrays/split-array.d.cts +6 -0
  242. package/dist/types/lib/arrays/unique.d.cts +3 -0
  243. package/dist/types/lib/auth/index.d.cts +1 -0
  244. package/dist/types/lib/auth/route-manager.d.cts +28 -0
  245. package/dist/types/lib/checks.d.cts +33 -0
  246. package/dist/types/lib/date/days.d.cts +7 -0
  247. package/dist/types/lib/date/index.d.cts +3 -0
  248. package/dist/types/lib/date/months.d.cts +11 -0
  249. package/dist/types/lib/date/time.d.cts +21 -0
  250. package/dist/types/lib/form/form-data.d.cts +9 -0
  251. package/dist/types/lib/form/index.d.cts +2 -0
  252. package/{src/lib/form/sanitize.js → dist/types/lib/form/sanitize.d.cts} +19 -39
  253. package/{src/lib/functions/callback.js → dist/types/lib/functions/callback.d.cts} +3 -3
  254. package/dist/types/lib/functions/debounce.d.cts +3 -0
  255. package/dist/types/lib/functions/env.d.cts +3 -0
  256. package/{src/lib/functions/functional.js → dist/types/lib/functions/functional.d.cts} +8 -49
  257. package/dist/types/lib/functions/index.d.cts +5 -0
  258. package/dist/types/lib/functions/throttle.d.cts +3 -0
  259. package/dist/types/lib/functions/timeout.d.cts +5 -0
  260. package/dist/types/lib/hash.d.cts +3 -0
  261. package/dist/types/lib/index.d.cts +43 -0
  262. package/dist/types/lib/numbers/index.d.cts +5 -0
  263. package/dist/types/lib/numbers/math.d.cts +4 -0
  264. package/dist/types/lib/objects/camelcase-keys.d.cts +3 -0
  265. package/dist/types/lib/objects/empty.d.cts +4 -0
  266. package/dist/types/lib/objects/equal.d.cts +4 -0
  267. package/dist/types/lib/objects/extend.d.cts +6 -0
  268. package/dist/types/lib/objects/flatten.d.cts +6 -0
  269. package/dist/types/lib/objects/index.d.cts +13 -0
  270. package/dist/types/lib/objects/json.d.cts +3 -0
  271. package/dist/types/lib/objects/loop.d.cts +4 -0
  272. package/dist/types/lib/objects/mix/mix.d.cts +44 -0
  273. package/{src/lib/objects/nested-property.js → dist/types/lib/objects/nested-property.d.cts} +4 -21
  274. package/dist/types/lib/objects/normalize-object.d.cts +3 -0
  275. package/dist/types/lib/objects/omit-empty.d.cts +3 -0
  276. package/dist/types/lib/objects/size.d.cts +3 -0
  277. package/dist/types/lib/objects/split.d.cts +14 -0
  278. package/dist/types/lib/promises/index.d.cts +1 -0
  279. package/dist/types/lib/promises/reject.d.cts +5 -0
  280. package/dist/types/lib/sse.d.cts +18 -0
  281. package/dist/types/lib/strings/convert-case/convert-case.d.cts +10 -0
  282. package/dist/types/lib/strings/index.d.cts +5 -0
  283. package/dist/types/lib/strings/markdown.d.cts +25 -0
  284. package/dist/types/lib/strings/name.d.cts +7 -0
  285. package/dist/types/lib/strings/pluralize.d.cts +3 -0
  286. package/dist/types/lib/strings/query-string.d.cts +10 -0
  287. package/dist/types/lib/style/index.d.cts +3 -0
  288. package/dist/types/lib/symbols/index.d.cts +1 -0
  289. package/dist/types/lib/symbols/symbols.d.cts +4 -0
  290. package/dist/types/node/context.d.cts +2 -0
  291. package/dist/types/node/dirname.d.cts +9 -0
  292. package/dist/types/node/file-cache.d.cts +56 -0
  293. package/dist/types/node/file.d.cts +4 -0
  294. package/dist/types/node/hash.d.cts +3 -0
  295. package/dist/types/node/index.d.cts +7 -0
  296. package/dist/types/node/pkce.d.cts +14 -0
  297. package/dist/types/node/random-string.d.cts +3 -0
  298. package/{src/node/sanitize.js → dist/types/node/sanitize.d.cts} +3 -6
  299. package/dist/types/node/uuid.d.cts +3 -0
  300. package/package.json +4 -1
  301. package/CHANGELOG.md +0 -237
  302. package/eslint.config.js +0 -2
  303. package/src/dom/accessibility.js +0 -58
  304. package/src/dom/actions/index.js +0 -3
  305. package/src/dom/actions/masonry.js +0 -43
  306. package/src/dom/actions/prefer-horizontal-scroll.js +0 -121
  307. package/src/dom/actions/sticky.js +0 -85
  308. package/src/dom/clipboard.js +0 -14
  309. package/src/dom/cookie.js +0 -32
  310. package/src/dom/css-vars.js +0 -19
  311. package/src/dom/font-size.js +0 -40
  312. package/src/dom/hash.js +0 -9
  313. package/src/dom/index.js +0 -23
  314. package/src/dom/media.js +0 -30
  315. package/src/dom/observers/index.js +0 -4
  316. package/src/dom/observers/intersection-observer.js +0 -43
  317. package/src/dom/observers/mutation-observer.js +0 -51
  318. package/src/dom/observers/observer.js +0 -18
  319. package/src/dom/observers/scroll-observer.js +0 -146
  320. package/src/dom/pkce.js +0 -34
  321. package/src/dom/query-params.js +0 -14
  322. package/src/dom/random-string.js +0 -18
  323. package/src/dom/random-string.test.js +0 -13
  324. package/src/dom/sanitize.js +0 -16
  325. package/src/dom/session-store.js +0 -29
  326. package/src/dom/spam-prevention.js +0 -40
  327. package/src/dom/trap-focus.js +0 -70
  328. package/src/dom/ui/aria-current.js +0 -20
  329. package/src/dom/ui/index.js +0 -4
  330. package/src/dom/ui/scroll-container.js +0 -25
  331. package/src/dom/ui/traverse-and-scramble.js +0 -61
  332. package/src/lib/arrays/index.js +0 -6
  333. package/src/lib/arrays/shuffle.js +0 -21
  334. package/src/lib/arrays/sort.js +0 -88
  335. package/src/lib/arrays/sort.spec.js +0 -123
  336. package/src/lib/arrays/split-array.js +0 -15
  337. package/src/lib/arrays/unique.js +0 -3
  338. package/src/lib/auth/index.js +0 -1
  339. package/src/lib/auth/route-manager.js +0 -45
  340. package/src/lib/checks.js +0 -57
  341. package/src/lib/date/days.js +0 -9
  342. package/src/lib/date/index.js +0 -3
  343. package/src/lib/date/months.js +0 -74
  344. package/src/lib/date/time.js +0 -83
  345. package/src/lib/form/form-data.js +0 -73
  346. package/src/lib/form/index.js +0 -2
  347. package/src/lib/form/sanitize.spec.js +0 -126
  348. package/src/lib/functions/debounce.js +0 -18
  349. package/src/lib/functions/env.js +0 -5
  350. package/src/lib/functions/functional.test.js +0 -196
  351. package/src/lib/functions/index.js +0 -5
  352. package/src/lib/functions/throttle.js +0 -11
  353. package/src/lib/functions/timeout.js +0 -15
  354. package/src/lib/hash.js +0 -18
  355. package/src/lib/hash.spec.js +0 -163
  356. package/src/lib/index.js +0 -14
  357. package/src/lib/numbers/index.js +0 -12
  358. package/src/lib/numbers/math.js +0 -9
  359. package/src/lib/numbers/split-unit.test.js +0 -45
  360. package/src/lib/objects/camelcase-keys.js +0 -17
  361. package/src/lib/objects/camelcase-keys.test.js +0 -72
  362. package/src/lib/objects/empty.js +0 -10
  363. package/src/lib/objects/equal.js +0 -9
  364. package/src/lib/objects/extend.js +0 -16
  365. package/src/lib/objects/extend.test.js +0 -35
  366. package/src/lib/objects/flatten.js +0 -19
  367. package/src/lib/objects/index.js +0 -13
  368. package/src/lib/objects/json.js +0 -7
  369. package/src/lib/objects/loop.js +0 -11
  370. package/src/lib/objects/loop.test.js +0 -31
  371. package/src/lib/objects/mix/mix.js +0 -191
  372. package/src/lib/objects/mix/mix.md +0 -78
  373. package/src/lib/objects/mix/mix.test.js +0 -445
  374. package/src/lib/objects/normalize-object.js +0 -10
  375. package/src/lib/objects/omit-empty.js +0 -23
  376. package/src/lib/objects/omit-empty.test.js +0 -85
  377. package/src/lib/objects/size.js +0 -41
  378. package/src/lib/objects/split.js +0 -19
  379. package/src/lib/promises/index.js +0 -1
  380. package/src/lib/promises/reject.js +0 -17
  381. package/src/lib/sse.js +0 -61
  382. package/src/lib/strings/convert-case/convert-case.js +0 -86
  383. package/src/lib/strings/convert-case/convert-case.md +0 -44
  384. package/src/lib/strings/convert-case/convert-case.test.js +0 -50
  385. package/src/lib/strings/index.js +0 -5
  386. package/src/lib/strings/markdown.js +0 -71
  387. package/src/lib/strings/markdown.spec.js +0 -73
  388. package/src/lib/strings/name.js +0 -24
  389. package/src/lib/strings/name.test.js +0 -67
  390. package/src/lib/strings/pluralize.js +0 -2
  391. package/src/lib/strings/query-string.js +0 -18
  392. package/src/lib/style/index.js +0 -13
  393. package/src/lib/symbols/index.js +0 -1
  394. package/src/lib/symbols/symbols.js +0 -9
  395. package/src/node/dirname.js +0 -17
  396. package/src/node/file-cache.js +0 -184
  397. package/src/node/file.js +0 -13
  398. package/src/node/hash.js +0 -5
  399. package/src/node/index.js +0 -7
  400. package/src/node/pkce.js +0 -33
  401. package/src/node/random-string.js +0 -10
  402. package/src/node/random-string.test.js +0 -15
  403. package/src/node/sanitize.spec.js +0 -142
  404. package/src/node/uuid.js +0 -5
  405. package/tsconfig.json +0 -23
  406. package/tsup.config.js +0 -38
  407. package/tsup.config.mjs +0 -63
  408. /package/{src/node/context.js → dist/cjs/node/context.cjs} +0 -0
@@ -1,14 +0,0 @@
1
- // ========================
2
- // Query Params
3
- // ========================
4
- export const queryParams = {
5
- get(key) {
6
- const searchParams = new URLSearchParams(location.search)
7
- return searchParams.get(key)
8
- },
9
-
10
- stringify(params) {
11
- const searchParams = new URLSearchParams(location.search)
12
- return searchParams.toString()
13
- },
14
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Generates a random string.
3
- * Ensures first character is a letter so it can be used in HTML ids and classes
4
- * This can actually be used everywhere, not just in the browser.
5
- */
6
- export function randomString(length = 10) {
7
- const firstLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26))
8
- const others = Math.random()
9
- .toString(36)
10
- .substring(2, 2 + length - 1)
11
-
12
- return firstLetter + others
13
- }
14
-
15
- // For browsers only
16
- export function uuid() {
17
- return crypto.randomUUID()
18
- }
@@ -1,13 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
- import { randomString } from './random-string.js'
3
-
4
- describe('randomString', () => {
5
- it('should generate a random string', () => {
6
- const str = randomString()
7
- expect(str).toBeDefined()
8
- expect(str.length).toBe(10)
9
-
10
- // Ensure the first character is a letter
11
- expect(str[0]).toMatch(/[a-zA-Z]/)
12
- })
13
- })
@@ -1,16 +0,0 @@
1
- import DOMPurify from 'dompurify'
2
- import { sanitize as sanitizeLib } from '../lib/form/sanitize.js'
3
-
4
- // Need to test if possible.
5
- // We can't test browser on node. So, unless we do like playwright or some form of browser testing, we can't actually verify this works every time.
6
- // Node version works already.
7
- /**
8
- * Sanitizes values using DOMPurify
9
- * @param {*} value - Value to sanitize (string, array, or object)
10
- * @param {Object} [options={}] - DOMPurify options
11
- * @returns {*} Sanitized value
12
- * @throws {Error} If input is a string but DOMPurify fails
13
- */
14
- export function sanitize(value, options = {}) {
15
- return sanitizeLib(value, { sanitizer: DOMPurify.sanitize, ...options })
16
- }
@@ -1,29 +0,0 @@
1
- // ========================
2
- // Session Storage
3
- // ========================
4
- export const sessionStore = {
5
- get(key) {
6
- const value = sessionStorage.getItem(key)
7
- if (!value) return
8
-
9
- try {
10
- // Returns an object if stored value is JSON
11
- return JSON.parse(value)
12
- } catch (error) {
13
- // Returns plain string if stored value is not JSON
14
- return value
15
- }
16
- },
17
-
18
- set(key, value) {
19
- if (typeof value === 'string') {
20
- sessionStorage.setItem(key, value)
21
- } else {
22
- sessionStorage.setItem(key, JSON.stringify(value))
23
- }
24
- },
25
-
26
- remove(key) {
27
- sessionStorage.removeItem(key)
28
- },
29
- }
@@ -1,40 +0,0 @@
1
- /**
2
- * Enhances a form element with spam detection capabilities
3
- * @param {HTMLFormElement} form - The form element to enhance
4
- * @param {Object} [options] - Configuration options
5
- * @param {string} [options.honeypotField] - Name of the honeypot field (default: 'hp')
6
- * @param {number} [options.honeypotDuration] - Minimum time in ms for legitimate form fill (default: 2000)
7
- * @returns {void}
8
- */
9
- export function preventSpam(
10
- form,
11
- { honeypotField = 'hp', honeypotDuration = 2000 } = {},
12
- ) {
13
- const startTime = Date.now()
14
- let hasInteraction = false
15
-
16
- function checkForInteraction() {
17
- hasInteraction = true
18
- }
19
-
20
- const events = ['keydown', 'mousemove', 'touchstart', 'click']
21
- events.forEach(event => {
22
- form.addEventListener(event, checkForInteraction, { once: true })
23
- })
24
-
25
- form.containsSpam = function () {
26
- const fillTime = Date.now() - startTime
27
- const isTooFast = fillTime < honeypotDuration
28
- /** @type {HTMLInputElement | null} */
29
- const honeypotInput = form.querySelector(`[name="${honeypotField}"]`)
30
- const hasHoneypotValue = honeypotInput?.value?.trim()
31
- const noInteraction = !hasInteraction
32
-
33
- // Clean up event listeners after use
34
- events.forEach(event =>
35
- form.removeEventListener(event, checkForInteraction),
36
- )
37
-
38
- return isTooFast || !!hasHoneypotValue || noInteraction
39
- }
40
- }
@@ -1,70 +0,0 @@
1
- import { getFocusableElements } from './focusable.js'
2
- import { isShiftTab, isTab } from './keyboard.js'
3
-
4
- /**
5
- * Traps focus within a set of focusable elements, creating a circular tab order
6
- * @param {Object} params
7
- * @param {KeyboardEvent} params.event - The keyboard event to handle
8
- * @param {import('./focusable.js').Focusables} params.focusables - Object containing focusable elements
9
- */
10
- export function trapFocus({ event, focusables }) {
11
- if (event.key !== 'Tab') return
12
- if (isTab(event) && document.activeElement === focusables.last) {
13
- event.preventDefault()
14
- focusables.first.focus()
15
- }
16
-
17
- // User presses shift + tab from the first focusable element.
18
- // Redirects to the last focusable element.
19
- if (isShiftTab(event) && document.activeElement === focusables.first) {
20
- event.preventDefault()
21
- focusables.last.focus()
22
- }
23
- }
24
-
25
- /**
26
- * Manages focus behavior when tabbing through content, with options to control focus on exit
27
- * @param {Object} params
28
- * @param {KeyboardEvent} params.event - The keyboard event to handle
29
- * @param {HTMLElement} params.triggerNode - Element that triggered the focus trap
30
- * @param {HTMLElement} params.contentNode - Container element that holds focusable content
31
- * @param {import('./focusable.js').Focusables} params.focusables - Object containing focusable elements
32
- * @param {'next'|'trigger'} [params.tabOutFocus='next'] - Where to focus when tabbing out: 'next' element or back to trigger
33
- * @param {Function} [params.onLeave=()=>{}] - Callback when focus leaves content, receives 'forward' or 'back' direction
34
- */
35
- export function manageFocus({
36
- event,
37
- triggerNode,
38
- contentNode,
39
- focusables,
40
- tabOutFocus = 'next', // 'trigger'
41
- onLeave = function () {},
42
- }) {
43
- const activeEl = document.activeElement
44
-
45
- if (activeEl === contentNode && isShiftTab(event)) return backFocus()
46
- if (activeEl === contentNode && focusables.length === 0 && isTab(event))
47
- return nextFocus()
48
-
49
- if (activeEl === focusables.last && isTab(event)) return nextFocus()
50
- if (activeEl === focusables.first && isShiftTab(event)) return backFocus()
51
-
52
- function backFocus() {
53
- event.preventDefault()
54
- triggerNode.focus()
55
- onLeave('back')
56
- }
57
-
58
- function nextFocus() {
59
- if (tabOutFocus === 'trigger') triggerNode.focus()
60
- if (tabOutFocus === 'next') {
61
- event.preventDefault()
62
- const DOMFocusables = getFocusableElements().keyboard
63
- const index = DOMFocusables.findIndex(e => e === triggerNode)
64
- const next = DOMFocusables[index + 1]
65
- if (next) next.focus()
66
- else triggerNode.focus()
67
- }
68
- onLeave('forward')
69
- }
70
- }
@@ -1,20 +0,0 @@
1
- export function markActiveAnchorIn(container, anchorType = 'page') {
2
- if (!container) return
3
-
4
- const { pathname } = window.location
5
- const element = container.querySelector(`[href="${pathname}"]`)
6
- if (!element) return
7
-
8
- // Mark the active element
9
- element.setAttribute('aria-current', 'page')
10
- return element
11
- }
12
-
13
- export function scrollToElement(
14
- element,
15
- { scrollBehaviour = 'instant', scrollMargin = '3rem' } = {},
16
- ) {
17
- if (!element) return
18
- element.style.scrollMarginTop = scrollMargin
19
- element.scrollIntoView({ behavior: scrollBehaviour })
20
- }
@@ -1,4 +0,0 @@
1
- export * from './aria-current.js'
2
- export * from './inconsistent-button-fix.js'
3
- export * from './scroll-container.js'
4
- export * from './traverse-and-scramble.js'
@@ -1,25 +0,0 @@
1
- export function findScrollContainer(element, direction = 'both') {
2
- if (!element) return
3
-
4
- let parent = element.parentElement
5
- while (parent) {
6
- const { overflow, overflowX, overflowY } = getComputedStyle(parent)
7
-
8
- if (direction === 'both') {
9
- if (overflow.includes('auto') || overflow.includes('scroll'))
10
- return parent
11
- }
12
-
13
- if (direction === 'horizontal') {
14
- if (overflowX === 'auto' || overflowX === 'scroll') return parent
15
- }
16
-
17
- if (direction === 'vertical') {
18
- if (overflowY === 'auto' || overflowY === 'scroll') return parent
19
- }
20
-
21
- parent = parent.parentElement
22
- }
23
-
24
- return document.documentElement
25
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * Traverses a DOM node and scrambles its text content, excluding specified elements.
3
- * Useful for creating placeholder/loading states or privacy features.
4
- *
5
- * @param {Element|ChildNode} node - The root element or node to start traversal from
6
- * @param {Object} [options] - Options for traversal
7
- * @param {string[]} [options.excludes=[]] - Array of CSS selectors to exclude from scrambling
8
- * @example
9
- * // Scramble all text in a container
10
- * traverseAndScramble(document.querySelector('.container'))
11
- *
12
- * // Scramble text but exclude certain elements
13
- * traverseAndScramble(document.body, {
14
- * excludes: ['.no-scramble', '[data-no-scramble]']
15
- * })
16
- */
17
- export function traverseAndScramble(node, { excludes = [] } = {}) {
18
- // Check if the current node matches any of the exclude selectors
19
- if (node instanceof Element && excludes.some(selector => node.matches(selector))) {
20
- return // Skip this node and its children
21
- }
22
-
23
- node.childNodes.forEach(child => {
24
- if (child.nodeType === 3) {
25
- // Node.TEXT_NODE
26
- child.nodeValue = scrambleText(child.nodeValue)
27
- } else if (child.nodeType === 1 && child instanceof Element) {
28
- // Node.ELEMENT_NODE
29
- traverseAndScramble(child, { excludes }) // Recurse into child elements with excludes
30
- }
31
- })
32
- }
33
-
34
- /**
35
- * Scrambles text by replacing alphanumeric characters with random ones.
36
- * Preserves case, punctuation, and other symbols.
37
- *
38
- * @param {string} text - The text to scramble
39
- * @returns {string} The scrambled text
40
- * @private
41
- * @example
42
- * scrambleText('Hello123!') // Returns something like 'Xk9mP2q!'
43
- */
44
- function scrambleText(text) {
45
- return text
46
- .split('')
47
- .map(char => {
48
- if (/^[A-Za-z0-9]$/.test(char)) {
49
- const randomCharCode =
50
- Math.random() < 26 / 36
51
- ? Math.floor(Math.random() * 26) +
52
- (char === char.toUpperCase() ? 65 : 97) // A-Z
53
- : Math.floor(Math.random() * 10) + 48 // 0-9
54
- return String.fromCharCode(randomCharCode)
55
- } else {
56
- // Keep punctuations and other symbols intact
57
- return char
58
- }
59
- })
60
- .join('')
61
- }
@@ -1,6 +0,0 @@
1
- export * from './item-position.js'
2
- export * from './join.js'
3
- export * from './shuffle.js'
4
- export * from './sort.js'
5
- export * from './split-array.js'
6
- export * from './unique.js'
@@ -1,21 +0,0 @@
1
- // Fisher Yates Shuffle without mutating the original array
2
- export function shuffle(array) {
3
- const clone = array.slice()
4
- let currentIndex = array.length
5
- let temporaryValue
6
- let randomIndex
7
-
8
- // While there remain elements to shuffle...
9
- while (currentIndex !== 0) {
10
- // Pick a remaining element...
11
- randomIndex = Math.floor(Math.random() * currentIndex)
12
- currentIndex -= 1
13
-
14
- // And swap it with the current element.
15
- temporaryValue = clone[currentIndex]
16
- clone[currentIndex] = clone[randomIndex]
17
- clone[randomIndex] = temporaryValue
18
- }
19
-
20
- return clone
21
- }
@@ -1,88 +0,0 @@
1
- import { getNestedValue } from '../objects/nested-property.js'
2
-
3
- /**
4
- * Sorts an array of objects, numbers, or strings without mutating the original array.
5
- * Supports nested properties, multiple sort keys, and various data types.
6
- *
7
- * @template T
8
- * @param {T[]} array - Array to sort
9
- * @param {Object} [options] - Sort options
10
- * @param {string|string[]|null} [options.props=null] - Property or array of properties to sort by. If null, sorts simple arrays
11
- * @param {boolean} [options.reverse=false] - Whether to sort in reverse order
12
- * @returns {T[]} New sorted array
13
- * @example
14
- * // Sort simple array
15
- * sort([3, 1, 2]) // [1, 2, 3]
16
- *
17
- * // Sort objects by single property
18
- * sort(users, { props: 'name' })
19
- *
20
- * // Sort objects by multiple properties
21
- * sort(users, { props: ['age', 'name'] })
22
- *
23
- * // Sort in reverse order
24
- * sort(users, { props: 'age', reverse: true })
25
- *
26
- * // Sort by nested property
27
- * sort(users, { props: 'address.city' })
28
- */
29
- export function sort(array, { props = null, reverse = false } = {}) {
30
- const clone = array.slice()
31
-
32
- // Handle simple arrays (numbers or strings)
33
- if (props === null) {
34
- return clone.sort((a, b) => {
35
- const comparison = compareValues(a, b)
36
- return reverse ? -comparison : comparison
37
- })
38
- }
39
-
40
- // Handle objects in arrays
41
- const properties = Array.isArray(props) ? props : [props]
42
-
43
- return clone.sort((a, b) => {
44
- for (const property of properties) {
45
- const aValue = getNestedValue(a, property)
46
- const bValue = getNestedValue(b, property)
47
-
48
- // Skip if values are equal
49
- if (aValue === bValue) continue
50
-
51
- // Push null/undefined values to the end
52
- if (aValue == null) return 1
53
- if (bValue == null) return -1
54
-
55
- // Compare values and handle reverse sort
56
- const comparison = compareValues(aValue, bValue)
57
- return reverse ? -comparison : comparison
58
- }
59
- return 0
60
- })
61
- }
62
-
63
- /**
64
- * Compares two values for sorting, handling different data types.
65
- * Supports numbers, strings, dates, and falls back to string comparison.
66
- *
67
- * @param {*} a - First value to compare
68
- * @param {*} b - Second value to compare
69
- * @returns {number} -1 if a < b, 0 if a === b, 1 if a > b
70
- * @private
71
- */
72
- function compareValues(a, b) {
73
- // Compare numbers
74
- if (typeof a === 'number' && typeof b === 'number') return a - b
75
-
76
- // Compare strings
77
- if (typeof a === 'string' && typeof b === 'string') return a.localeCompare(b)
78
-
79
- // Compare dates
80
- const aDate = new Date(a)
81
- const bDate = new Date(b)
82
- const aTime = aDate.getTime()
83
- const bTime = bDate.getTime()
84
- if (!isNaN(aTime) && !isNaN(bTime)) return aTime - bTime
85
-
86
- // Convert into strings and compare
87
- return String(a).localeCompare(String(b))
88
- }
@@ -1,123 +0,0 @@
1
- import { describe, expect, it } from 'vitest'
2
-
3
- import { sort } from './index.js'
4
-
5
- describe('Sort by', _ => {
6
- it('Standard array - numbers', async () => {
7
- const array = [3, 1, 2]
8
- const sorted = sort(array)
9
- const reversed = sort(array, { reverse: true })
10
- expect(sorted).toEqual([1, 2, 3])
11
- expect(reversed).toEqual([3, 2, 1])
12
- })
13
-
14
- it('Standard array - strings', async () => {
15
- const array = ['c', 'a', 'b']
16
- const sorted = sort(array)
17
- const reversed = sort(array, { reverse: true })
18
- expect(sorted).toEqual(['a', 'b', 'c'])
19
- expect(reversed).toEqual(['c', 'b', 'a'])
20
- })
21
-
22
- it('Standard array - dates', async () => {
23
- const array = [
24
- new Date('2021-05-18'),
25
- new Date('2022-01-01'),
26
- new Date('2025-03-09'),
27
- ]
28
- const sorted = sort(array)
29
- const reversed = sort(array, { reverse: true })
30
- expect(sorted).toEqual([
31
- new Date('2021-05-18'),
32
- new Date('2022-01-01'),
33
- new Date('2025-03-09'),
34
- ])
35
- expect(reversed).toEqual([
36
- new Date('2025-03-09'),
37
- new Date('2022-01-01'),
38
- new Date('2021-05-18'),
39
- ])
40
- })
41
- it('Array of objects — simple integer', async () => {
42
- const array = [
43
- { name: 'Ace', age: 30 },
44
- { name: 'Betty', age: 25 },
45
- { name: 'Candy', age: 35 },
46
- ]
47
- const sorted = sort(array, { props: 'age' })
48
- const reversed = sort(array, { props: 'age', reverse: true })
49
- expect(sorted).toEqual([
50
- { name: 'Betty', age: 25 },
51
- { name: 'Ace', age: 30 },
52
- { name: 'Candy', age: 35 },
53
- ])
54
- expect(reversed).toEqual([
55
- { name: 'Candy', age: 35 },
56
- { name: 'Ace', age: 30 },
57
- { name: 'Betty', age: 25 },
58
- ])
59
- })
60
-
61
- it('Array of objects — simple string', async () => {
62
- const array = [
63
- { name: 'Ace', age: 30 },
64
- { name: 'Betty', age: 25 },
65
- { name: 'Candy', age: 35 },
66
- ]
67
- const sorted = sort(array, { props: 'name' })
68
- const reversed = sort(array, { props: 'name', reverse: true })
69
- expect(sorted).toEqual([
70
- { name: 'Ace', age: 30 },
71
- { name: 'Betty', age: 25 },
72
- { name: 'Candy', age: 35 },
73
- ])
74
- expect(reversed).toEqual([
75
- { name: 'Candy', age: 35 },
76
- { name: 'Betty', age: 25 },
77
- { name: 'Ace', age: 30 },
78
- ])
79
- })
80
-
81
- it('Double property', async () => {
82
- const array = [
83
- { name: 'Ace', age: 30 },
84
- { name: 'Betty', age: 25 },
85
- { name: 'Candy', age: 35 },
86
- { name: 'Danny', age: 30 },
87
- ]
88
- const sorted = sort(array, { props: ['age', 'name'] })
89
- const reversed = sort(array, { props: ['age', 'name'], reverse: true })
90
- expect(sorted).toEqual([
91
- { name: 'Betty', age: 25 },
92
- { name: 'Ace', age: 30 },
93
- { name: 'Danny', age: 30 },
94
- { name: 'Candy', age: 35 },
95
- ])
96
- expect(reversed).toEqual([
97
- { name: 'Candy', age: 35 },
98
- { name: 'Danny', age: 30 },
99
- { name: 'Ace', age: 30 },
100
- { name: 'Betty', age: 25 },
101
- ])
102
- })
103
-
104
- it('Nested value', async () => {
105
- const array = [
106
- { data: { value: 1 } },
107
- { data: { value: 2 } },
108
- { data: { value: 3 } },
109
- ]
110
- const sorted = sort(array, { props: 'data.value' })
111
- const reversed = sort(array, { props: 'data.value', reverse: true })
112
- expect(sorted).toEqual([
113
- { data: { value: 1 } },
114
- { data: { value: 2 } },
115
- { data: { value: 3 } },
116
- ])
117
- expect(reversed).toEqual([
118
- { data: { value: 3 } },
119
- { data: { value: 2 } },
120
- { data: { value: 1 } },
121
- ])
122
- })
123
- })
@@ -1,15 +0,0 @@
1
- export function splitArray(array, predicate) {
2
- const ret = {
3
- picked: [],
4
- omitted: [],
5
- }
6
-
7
- array.forEach((item, index, arr) => {
8
- if (predicate(item, index, arr)) ret.picked.push(item)
9
- else ret.omitted.push(item)
10
- })
11
-
12
- ret.p = ret.picked
13
- ret.o = ret.omitted
14
- return ret
15
- }
@@ -1,3 +0,0 @@
1
- export function uniqueArray(array) {
2
- return Array.from(new Set(array))
3
- }
@@ -1 +0,0 @@
1
- export * from './route-manager.js'
@@ -1,45 +0,0 @@
1
- /**
2
- // Usage ... Probably should use either protected or bypass, not both.
3
- // Maybe ... glob would be a better for this
4
- @example
5
- const config = {
6
- routeConfig: {
7
- startsWith: ['/dashboard']
8
- }
9
- bypassRoutes: {
10
- is: ['/'],
11
- startsWith: ['/fonts', '/auth', '/favicon', '/images'],
12
- includes: ['/meh'],
13
- }
14
- }
15
- const {isProtectedRoute, isBypassRoute} = AuthManager(config)
16
- if (!isProtectedRoute(context.url.pathname)) return next() // Handle only protected routes
17
- if (isBypassRoute(context.url.pathname)) return next() // Bypass all non protected routes
18
- */
19
-
20
- export function RouteManager(config) {
21
- const { protectedRoutes, bypassRoutes } = config
22
- return {
23
- isProtectedRoute(pathname) {
24
- return isMatch(protectedRoutes, pathname)
25
- },
26
- isBypassRoute(pathname) {
27
- return isMatch(bypassRoutes, pathname)
28
- },
29
- }
30
- }
31
-
32
- // Alias for RouteManager
33
- export function AuthManager(config) {
34
- return RouteManager(config)
35
- }
36
-
37
- function isMatch(routeConfig, pathname) {
38
- const { is, startsWith, includes } = routeConfig
39
- const isExactMatch = is && is.some(u => pathname === u)
40
- const startsWithMatch =
41
- startsWith && startsWith.some(u => pathname.startsWith(u))
42
- const includesMatch = includes && includes.some(u => pathname.includes(u))
43
-
44
- return isExactMatch || startsWithMatch || includesMatch
45
- }