@wener/utils 1.0.0-alpha.8 → 1.1.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 (360) hide show
  1. package/LICENSE.md +7 -0
  2. package/README.md +28 -0
  3. package/dist/utils.cjs +497 -0
  4. package/dist/utils.cjs.map +7 -0
  5. package/dist/utils.js +445 -0
  6. package/dist/utils.js.map +7 -0
  7. package/dist/utils.mjs +475 -0
  8. package/dist/utils.mjs.map +7 -0
  9. package/jest.config.js +8 -6
  10. package/lib/{arrays → cjs/arrays}/MaybeArray.d.ts +1 -0
  11. package/lib/{arrays → cjs/arrays}/MaybeArray.js +8 -0
  12. package/lib/cjs/arrays/MaybeArray.js.map +1 -0
  13. package/lib/{arrays → cjs/arrays}/index.d.ts +0 -0
  14. package/lib/cjs/arrays/index.js +5 -0
  15. package/lib/cjs/arrays/index.js.map +1 -0
  16. package/lib/{asyncs → cjs/asyncs}/AsyncInterval.d.ts +0 -0
  17. package/lib/{asyncs → cjs/asyncs}/AsyncInterval.js +2 -1
  18. package/lib/cjs/asyncs/AsyncInterval.js.map +1 -0
  19. package/lib/{asyncs → cjs/asyncs}/LazyPromise.d.ts +0 -0
  20. package/lib/cjs/asyncs/LazyPromise.js +26 -0
  21. package/lib/cjs/asyncs/LazyPromise.js.map +1 -0
  22. package/lib/cjs/asyncs/MaybePromise.d.ts +1 -0
  23. package/lib/cjs/asyncs/MaybePromise.js +3 -0
  24. package/lib/cjs/asyncs/MaybePromise.js.map +1 -0
  25. package/lib/cjs/asyncs/generatorOfStream.d.ts +1 -0
  26. package/lib/cjs/asyncs/generatorOfStream.js +18 -0
  27. package/lib/cjs/asyncs/generatorOfStream.js.map +1 -0
  28. package/lib/cjs/asyncs/index.d.ts +7 -0
  29. package/lib/cjs/asyncs/index.js +11 -0
  30. package/lib/cjs/asyncs/index.js.map +1 -0
  31. package/lib/cjs/asyncs/isPromise.d.ts +1 -0
  32. package/lib/cjs/asyncs/isPromise.js +8 -0
  33. package/lib/cjs/asyncs/isPromise.js.map +1 -0
  34. package/lib/cjs/asyncs/promiseOfCallback.d.ts +1 -0
  35. package/lib/cjs/asyncs/promiseOfCallback.js +22 -0
  36. package/lib/cjs/asyncs/promiseOfCallback.js.map +1 -0
  37. package/lib/{asyncs → cjs/asyncs}/sleep.d.ts +0 -0
  38. package/lib/cjs/asyncs/sleep.js +6 -0
  39. package/lib/cjs/asyncs/sleep.js.map +1 -0
  40. package/lib/cjs/asyncs/timeout.d.ts +4 -0
  41. package/lib/cjs/asyncs/timeout.js +27 -0
  42. package/lib/cjs/asyncs/timeout.js.map +1 -0
  43. package/lib/{browsers/clipboard.d.ts → cjs/browsers/copy.d.ts} +0 -0
  44. package/lib/{browsers/clipboard.js → cjs/browsers/copy.js} +3 -3
  45. package/lib/cjs/browsers/copy.js.map +1 -0
  46. package/lib/{browsers → cjs/browsers}/download.d.ts +0 -0
  47. package/lib/{browsers → cjs/browsers}/download.js +1 -0
  48. package/lib/cjs/browsers/download.js.map +1 -0
  49. package/lib/cjs/browsers/getFileFromDataTransfer.d.ts +4 -0
  50. package/lib/{browsers/transfers.js → cjs/browsers/getFileFromDataTransfer.js} +15 -11
  51. package/lib/cjs/browsers/getFileFromDataTransfer.js.map +1 -0
  52. package/lib/cjs/browsers/index.d.ts +4 -0
  53. package/lib/cjs/browsers/index.js +8 -0
  54. package/lib/cjs/browsers/index.js.map +1 -0
  55. package/lib/{browsers → cjs/browsers}/loaders.d.ts +0 -0
  56. package/lib/{browsers → cjs/browsers}/loaders.js +2 -1
  57. package/lib/cjs/browsers/loaders.js.map +1 -0
  58. package/lib/cjs/formats/formatBytes.d.ts +11 -0
  59. package/lib/cjs/formats/formatBytes.js +31 -0
  60. package/lib/cjs/formats/formatBytes.js.map +1 -0
  61. package/lib/cjs/index.d.ts +9 -0
  62. package/lib/cjs/index.js +15 -0
  63. package/lib/cjs/index.js.map +1 -0
  64. package/lib/{io → cjs/io}/index.d.ts +0 -0
  65. package/lib/cjs/io/index.js +5 -0
  66. package/lib/{io → cjs/io}/index.js.map +1 -1
  67. package/lib/{io → cjs/io}/isBuffer.d.ts +0 -0
  68. package/lib/{io → cjs/io}/isBuffer.js +1 -0
  69. package/lib/cjs/io/isBuffer.js.map +1 -0
  70. package/lib/{isomorphics → cjs/isomorphics}/getGlobalThis.d.ts +1 -1
  71. package/lib/{isomorphics → cjs/isomorphics}/getGlobalThis.js +5 -6
  72. package/lib/cjs/isomorphics/getGlobalThis.js.map +1 -0
  73. package/lib/{isomorphics → cjs/isomorphics}/index.d.ts +0 -0
  74. package/lib/cjs/isomorphics/index.js +5 -0
  75. package/lib/cjs/isomorphics/index.js.map +1 -0
  76. package/lib/{maths → cjs/maths}/index.d.ts +0 -0
  77. package/lib/cjs/maths/index.js +5 -0
  78. package/lib/{arrays → cjs/maths}/index.js.map +1 -1
  79. package/lib/cjs/maths/random.d.ts +3 -0
  80. package/lib/{maths → cjs/maths}/random.js +6 -5
  81. package/lib/cjs/maths/random.js.map +1 -0
  82. package/lib/{strings → cjs/strings}/camelCase.d.ts +0 -0
  83. package/lib/{strings → cjs/strings}/camelCase.js +2 -1
  84. package/lib/cjs/strings/camelCase.js.map +1 -0
  85. package/lib/{strings → cjs/strings}/index.d.ts +1 -0
  86. package/lib/cjs/strings/index.js +7 -0
  87. package/lib/cjs/strings/index.js.map +1 -0
  88. package/lib/{strings → cjs/strings}/templates.d.ts +1 -1
  89. package/lib/{strings → cjs/strings}/templates.js +3 -3
  90. package/lib/cjs/strings/templates.js.map +1 -0
  91. package/lib/cjs/strings/urljoin.d.ts +2 -0
  92. package/lib/cjs/strings/urljoin.js +69 -0
  93. package/lib/cjs/strings/urljoin.js.map +1 -0
  94. package/lib/cjs/strings/urljoin.test.d.ts +1 -0
  95. package/lib/cjs/strings/urljoin.test.js +7 -0
  96. package/lib/cjs/strings/urljoin.test.js.map +1 -0
  97. package/lib/{validations → cjs/validations}/asserts.d.ts +0 -0
  98. package/lib/{validations → cjs/validations}/asserts.js +1 -0
  99. package/lib/cjs/validations/asserts.js.map +1 -0
  100. package/lib/cjs/validations/index.d.ts +4 -0
  101. package/lib/cjs/validations/index.js +8 -0
  102. package/lib/cjs/validations/index.js.map +1 -0
  103. package/lib/cjs/validations/isClass.d.ts +1 -0
  104. package/lib/cjs/validations/isClass.js +8 -0
  105. package/lib/cjs/validations/isClass.js.map +1 -0
  106. package/lib/cjs/validations/isDefined.d.ts +1 -0
  107. package/lib/cjs/validations/isDefined.js +8 -0
  108. package/lib/cjs/validations/isDefined.js.map +1 -0
  109. package/lib/cjs/validations/isEmptyObject.d.ts +1 -0
  110. package/lib/cjs/validations/isEmptyObject.js +11 -0
  111. package/lib/cjs/validations/isEmptyObject.js.map +1 -0
  112. package/lib/esm/arrays/MaybeArray.d.ts +5 -0
  113. package/lib/esm/arrays/MaybeArray.js +33 -0
  114. package/lib/esm/arrays/index.d.ts +1 -0
  115. package/lib/esm/arrays/index.js +1 -0
  116. package/lib/esm/asyncs/AsyncInterval.d.ts +3 -0
  117. package/lib/esm/asyncs/AsyncInterval.js +16 -0
  118. package/lib/esm/asyncs/LazyPromise.d.ts +5 -0
  119. package/lib/esm/asyncs/LazyPromise.js +24 -0
  120. package/lib/esm/asyncs/MaybePromise.d.ts +1 -0
  121. package/lib/esm/asyncs/MaybePromise.js +0 -0
  122. package/lib/esm/asyncs/generatorOfStream.d.ts +1 -0
  123. package/lib/esm/asyncs/generatorOfStream.js +16 -0
  124. package/lib/esm/asyncs/index.d.ts +7 -0
  125. package/lib/esm/asyncs/index.js +7 -0
  126. package/lib/esm/asyncs/isPromise.d.ts +1 -0
  127. package/lib/esm/asyncs/isPromise.js +6 -0
  128. package/lib/esm/asyncs/promiseOfCallback.d.ts +1 -0
  129. package/lib/esm/asyncs/promiseOfCallback.js +18 -0
  130. package/lib/esm/asyncs/sleep.d.ts +1 -0
  131. package/lib/esm/asyncs/sleep.js +4 -0
  132. package/lib/esm/asyncs/timeout.d.ts +4 -0
  133. package/lib/esm/asyncs/timeout.js +25 -0
  134. package/lib/esm/browsers/copy.d.ts +1 -0
  135. package/lib/esm/browsers/copy.js +52 -0
  136. package/lib/esm/browsers/download.d.ts +4 -0
  137. package/lib/esm/browsers/download.js +28 -0
  138. package/lib/esm/browsers/getFileFromDataTransfer.d.ts +4 -0
  139. package/lib/esm/browsers/getFileFromDataTransfer.js +29 -0
  140. package/lib/esm/browsers/index.d.ts +4 -0
  141. package/lib/esm/browsers/index.js +4 -0
  142. package/lib/esm/browsers/loaders.d.ts +6 -0
  143. package/lib/esm/browsers/loaders.js +35 -0
  144. package/lib/esm/formats/formatBytes.d.ts +11 -0
  145. package/lib/esm/formats/formatBytes.js +17 -0
  146. package/lib/esm/index.d.ts +9 -0
  147. package/lib/esm/index.js +12 -0
  148. package/lib/esm/io/index.d.ts +1 -0
  149. package/lib/esm/io/index.js +1 -0
  150. package/lib/esm/io/isBuffer.d.ts +2 -0
  151. package/lib/esm/io/isBuffer.js +6 -0
  152. package/lib/esm/isomorphics/getGlobalThis.d.ts +9 -0
  153. package/lib/esm/isomorphics/getGlobalThis.js +14 -0
  154. package/lib/esm/isomorphics/index.d.ts +1 -0
  155. package/lib/esm/isomorphics/index.js +1 -0
  156. package/lib/esm/maths/index.d.ts +1 -0
  157. package/lib/esm/maths/index.js +1 -0
  158. package/lib/esm/maths/random.d.ts +3 -0
  159. package/lib/esm/maths/random.js +17 -0
  160. package/lib/esm/strings/camelCase.d.ts +4 -0
  161. package/lib/esm/strings/camelCase.js +57 -0
  162. package/lib/esm/strings/index.d.ts +3 -0
  163. package/lib/esm/strings/index.js +3 -0
  164. package/lib/esm/strings/templates.d.ts +7 -0
  165. package/lib/esm/strings/templates.js +8 -0
  166. package/lib/esm/strings/urljoin.d.ts +2 -0
  167. package/lib/esm/strings/urljoin.js +53 -0
  168. package/lib/esm/strings/urljoin.test.d.ts +1 -0
  169. package/lib/esm/strings/urljoin.test.js +4 -0
  170. package/lib/esm/validations/asserts.d.ts +2 -0
  171. package/lib/esm/validations/asserts.js +10 -0
  172. package/lib/esm/validations/index.d.ts +4 -0
  173. package/lib/esm/validations/index.js +4 -0
  174. package/lib/esm/validations/isClass.d.ts +1 -0
  175. package/lib/esm/validations/isClass.js +6 -0
  176. package/lib/esm/validations/isDefined.d.ts +1 -0
  177. package/lib/esm/validations/isDefined.js +6 -0
  178. package/lib/esm/validations/isEmptyObject.d.ts +1 -0
  179. package/lib/esm/validations/isEmptyObject.js +9 -0
  180. package/lib/esnext/arrays/MaybeArray.d.ts +5 -0
  181. package/lib/esnext/arrays/MaybeArray.js +28 -0
  182. package/lib/esnext/arrays/MaybeArray.js.map +1 -0
  183. package/lib/esnext/arrays/index.d.ts +1 -0
  184. package/lib/esnext/arrays/index.js +2 -0
  185. package/lib/esnext/arrays/index.js.map +1 -0
  186. package/lib/esnext/asyncs/AsyncInterval.d.ts +3 -0
  187. package/lib/esnext/asyncs/AsyncInterval.js +13 -0
  188. package/lib/esnext/asyncs/AsyncInterval.js.map +1 -0
  189. package/lib/esnext/asyncs/LazyPromise.d.ts +5 -0
  190. package/lib/esnext/asyncs/LazyPromise.js +22 -0
  191. package/lib/esnext/asyncs/LazyPromise.js.map +1 -0
  192. package/lib/esnext/asyncs/MaybePromise.d.ts +1 -0
  193. package/lib/esnext/asyncs/MaybePromise.js +2 -0
  194. package/lib/esnext/asyncs/MaybePromise.js.map +1 -0
  195. package/lib/esnext/asyncs/generatorOfStream.d.ts +1 -0
  196. package/lib/esnext/asyncs/generatorOfStream.js +14 -0
  197. package/lib/esnext/asyncs/generatorOfStream.js.map +1 -0
  198. package/lib/esnext/asyncs/index.d.ts +7 -0
  199. package/lib/esnext/asyncs/index.js +8 -0
  200. package/lib/esnext/asyncs/index.js.map +1 -0
  201. package/lib/esnext/asyncs/isPromise.d.ts +1 -0
  202. package/lib/esnext/asyncs/isPromise.js +4 -0
  203. package/lib/esnext/asyncs/isPromise.js.map +1 -0
  204. package/lib/esnext/asyncs/promiseOfCallback.d.ts +1 -0
  205. package/lib/esnext/asyncs/promiseOfCallback.js +18 -0
  206. package/lib/esnext/asyncs/promiseOfCallback.js.map +1 -0
  207. package/lib/esnext/asyncs/sleep.d.ts +1 -0
  208. package/lib/esnext/asyncs/sleep.js +2 -0
  209. package/lib/esnext/asyncs/sleep.js.map +1 -0
  210. package/lib/esnext/asyncs/timeout.d.ts +4 -0
  211. package/lib/esnext/asyncs/timeout.js +22 -0
  212. package/lib/esnext/asyncs/timeout.js.map +1 -0
  213. package/lib/esnext/browsers/copy.d.ts +1 -0
  214. package/lib/esnext/browsers/copy.js +51 -0
  215. package/lib/esnext/browsers/copy.js.map +1 -0
  216. package/lib/esnext/browsers/download.d.ts +4 -0
  217. package/lib/esnext/browsers/download.js +31 -0
  218. package/lib/esnext/browsers/download.js.map +1 -0
  219. package/lib/esnext/browsers/getFileFromDataTransfer.d.ts +4 -0
  220. package/lib/esnext/browsers/getFileFromDataTransfer.js +37 -0
  221. package/lib/esnext/browsers/getFileFromDataTransfer.js.map +1 -0
  222. package/lib/esnext/browsers/index.d.ts +4 -0
  223. package/lib/esnext/browsers/index.js +5 -0
  224. package/lib/esnext/browsers/index.js.map +1 -0
  225. package/lib/esnext/browsers/loaders.d.ts +6 -0
  226. package/lib/esnext/browsers/loaders.js +33 -0
  227. package/lib/esnext/browsers/loaders.js.map +1 -0
  228. package/lib/esnext/formats/formatBytes.d.ts +11 -0
  229. package/lib/esnext/formats/formatBytes.js +27 -0
  230. package/lib/esnext/formats/formatBytes.js.map +1 -0
  231. package/lib/esnext/index.d.ts +9 -0
  232. package/lib/esnext/index.js +10 -0
  233. package/lib/esnext/index.js.map +1 -0
  234. package/lib/esnext/io/index.d.ts +1 -0
  235. package/lib/esnext/io/index.js +2 -0
  236. package/lib/esnext/io/index.js.map +1 -0
  237. package/lib/esnext/io/isBuffer.d.ts +2 -0
  238. package/lib/esnext/io/isBuffer.js +8 -0
  239. package/lib/esnext/io/isBuffer.js.map +1 -0
  240. package/lib/esnext/isomorphics/getGlobalThis.d.ts +9 -0
  241. package/lib/esnext/isomorphics/getGlobalThis.js +21 -0
  242. package/lib/esnext/isomorphics/getGlobalThis.js.map +1 -0
  243. package/lib/esnext/isomorphics/index.d.ts +1 -0
  244. package/lib/esnext/isomorphics/index.js +2 -0
  245. package/lib/esnext/isomorphics/index.js.map +1 -0
  246. package/lib/esnext/maths/index.d.ts +1 -0
  247. package/lib/esnext/maths/index.js +2 -0
  248. package/lib/esnext/maths/index.js.map +1 -0
  249. package/lib/esnext/maths/random.d.ts +3 -0
  250. package/lib/esnext/maths/random.js +16 -0
  251. package/lib/esnext/maths/random.js.map +1 -0
  252. package/lib/esnext/strings/camelCase.d.ts +4 -0
  253. package/lib/esnext/strings/camelCase.js +68 -0
  254. package/lib/esnext/strings/camelCase.js.map +1 -0
  255. package/lib/esnext/strings/index.d.ts +3 -0
  256. package/lib/esnext/strings/index.js +4 -0
  257. package/lib/esnext/strings/index.js.map +1 -0
  258. package/lib/esnext/strings/templates.d.ts +7 -0
  259. package/lib/esnext/strings/templates.js +14 -0
  260. package/lib/esnext/strings/templates.js.map +1 -0
  261. package/lib/esnext/strings/urljoin.d.ts +2 -0
  262. package/lib/esnext/strings/urljoin.js +65 -0
  263. package/lib/esnext/strings/urljoin.js.map +1 -0
  264. package/lib/esnext/strings/urljoin.test.d.ts +1 -0
  265. package/lib/esnext/strings/urljoin.test.js +5 -0
  266. package/lib/esnext/strings/urljoin.test.js.map +1 -0
  267. package/lib/esnext/validations/asserts.d.ts +2 -0
  268. package/lib/esnext/validations/asserts.js +13 -0
  269. package/lib/esnext/validations/asserts.js.map +1 -0
  270. package/lib/esnext/validations/index.d.ts +4 -0
  271. package/lib/esnext/validations/index.js +5 -0
  272. package/lib/esnext/validations/index.js.map +1 -0
  273. package/lib/esnext/validations/isClass.d.ts +1 -0
  274. package/lib/esnext/validations/isClass.js +4 -0
  275. package/lib/esnext/validations/isClass.js.map +1 -0
  276. package/lib/esnext/validations/isDefined.d.ts +1 -0
  277. package/lib/esnext/validations/isDefined.js +4 -0
  278. package/lib/esnext/validations/isDefined.js.map +1 -0
  279. package/lib/esnext/validations/isEmptyObject.d.ts +1 -0
  280. package/lib/esnext/validations/isEmptyObject.js +7 -0
  281. package/lib/esnext/validations/isEmptyObject.js.map +1 -0
  282. package/package.json +36 -32
  283. package/src/arrays/MaybeArray.ts +13 -0
  284. package/src/asyncs/LazyPromise.ts +16 -9
  285. package/src/asyncs/MaybePromise.ts +1 -0
  286. package/src/asyncs/generatorOfStream.ts +13 -0
  287. package/src/asyncs/index.ts +8 -3
  288. package/src/asyncs/isPromise.ts +3 -0
  289. package/src/asyncs/promiseOfCallback.ts +15 -0
  290. package/src/asyncs/timeout.ts +25 -0
  291. package/src/browsers/{clipboard.ts → copy.ts} +0 -0
  292. package/src/browsers/{transfers.ts → getFileFromDataTransfer.ts} +13 -8
  293. package/src/browsers/index.ts +4 -4
  294. package/src/browsers/loaders.ts +7 -2
  295. package/src/formats/formatBytes.ts +30 -0
  296. package/src/index.ts +5 -3
  297. package/src/isomorphics/getGlobalThis.ts +2 -4
  298. package/src/maths/random.ts +5 -5
  299. package/src/strings/camelCase.ts +2 -2
  300. package/src/strings/index.ts +1 -0
  301. package/src/strings/templates.ts +2 -4
  302. package/src/strings/urljoin.test.ts +5 -0
  303. package/src/strings/urljoin.ts +79 -0
  304. package/src/validations/index.ts +3 -0
  305. package/src/validations/isClass.ts +3 -0
  306. package/src/validations/isDefined.ts +3 -0
  307. package/src/validations/isEmptyObject.ts +6 -0
  308. package/tsconfig.json +26 -6
  309. package/dist/utils.es5.js +0 -1759
  310. package/dist/utils.es5.js.map +0 -1
  311. package/dist/utils.umd.js +0 -1769
  312. package/dist/utils.umd.js.map +0 -1
  313. package/lib/arrays/MaybeArray.js.map +0 -1
  314. package/lib/arrays/index.js +0 -7
  315. package/lib/asyncs/AsyncInterval.js.map +0 -1
  316. package/lib/asyncs/LazyPromise.js +0 -18
  317. package/lib/asyncs/LazyPromise.js.map +0 -1
  318. package/lib/asyncs/index.d.ts +0 -3
  319. package/lib/asyncs/index.js +0 -9
  320. package/lib/asyncs/index.js.map +0 -1
  321. package/lib/asyncs/sleep.js +0 -4
  322. package/lib/asyncs/sleep.js.map +0 -1
  323. package/lib/browsers/clipboard.js.map +0 -1
  324. package/lib/browsers/download.js.map +0 -1
  325. package/lib/browsers/index.d.ts +0 -4
  326. package/lib/browsers/index.js +0 -10
  327. package/lib/browsers/index.js.map +0 -1
  328. package/lib/browsers/loaders.js.map +0 -1
  329. package/lib/browsers/transfers.d.ts +0 -4
  330. package/lib/browsers/transfers.js.map +0 -1
  331. package/lib/envs/index.d.ts +0 -1
  332. package/lib/envs/index.js +0 -7
  333. package/lib/envs/index.js.map +0 -1
  334. package/lib/envs/isDev.d.ts +0 -1
  335. package/lib/envs/isDev.js +0 -4
  336. package/lib/envs/isDev.js.map +0 -1
  337. package/lib/index.d.ts +0 -8
  338. package/lib/index.js +0 -14
  339. package/lib/index.js.map +0 -1
  340. package/lib/io/index.js +0 -7
  341. package/lib/io/isBuffer.js.map +0 -1
  342. package/lib/isomorphics/getGlobalThis.js.map +0 -1
  343. package/lib/isomorphics/index.js +0 -7
  344. package/lib/isomorphics/index.js.map +0 -1
  345. package/lib/maths/index.js +0 -7
  346. package/lib/maths/index.js.map +0 -1
  347. package/lib/maths/random.d.ts +0 -3
  348. package/lib/maths/random.js.map +0 -1
  349. package/lib/strings/camelCase.js.map +0 -1
  350. package/lib/strings/index.js +0 -8
  351. package/lib/strings/index.js.map +0 -1
  352. package/lib/strings/templates.js.map +0 -1
  353. package/lib/validations/asserts.js.map +0 -1
  354. package/lib/validations/index.d.ts +0 -1
  355. package/lib/validations/index.js +0 -7
  356. package/lib/validations/index.js.map +0 -1
  357. package/rollup.config.ts +0 -34
  358. package/src/envs/index.ts +0 -1
  359. package/src/envs/isDev.ts +0 -1
  360. package/tsconfig.rollup.json +0 -9
package/dist/utils.umd.js DELETED
@@ -1,1769 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = global || self, factory(global.utils = {}));
5
- }(this, (function (exports) { 'use strict';
6
-
7
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
8
-
9
- function unwrapExports (x) {
10
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
11
- }
12
-
13
- function createCommonjsModule(fn, module) {
14
- return module = { exports: {} }, fn(module, module.exports), module.exports;
15
- }
16
-
17
- var MaybeArray = createCommonjsModule(function (module, exports) {
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- function firstOfMaybeArray(v) {
20
- if (Array.isArray(v)) {
21
- return v[0];
22
- }
23
- return v;
24
- }
25
- exports.firstOfMaybeArray = firstOfMaybeArray;
26
- function lastOfMaybeArray(v) {
27
- if (Array.isArray(v)) {
28
- return v[v.length - 1];
29
- }
30
- return v;
31
- }
32
- exports.lastOfMaybeArray = lastOfMaybeArray;
33
- function arrayOfMaybeArray(v) {
34
- if (Array.isArray(v)) {
35
- return v;
36
- }
37
- if (v === null || v === undefined) {
38
- return [];
39
- }
40
- return [v];
41
- }
42
- exports.arrayOfMaybeArray = arrayOfMaybeArray;
43
-
44
- });
45
-
46
- unwrapExports(MaybeArray);
47
- var MaybeArray_1 = MaybeArray.firstOfMaybeArray;
48
- var MaybeArray_2 = MaybeArray.lastOfMaybeArray;
49
- var MaybeArray_3 = MaybeArray.arrayOfMaybeArray;
50
-
51
- var arrays = createCommonjsModule(function (module, exports) {
52
- function __export(m) {
53
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
54
- }
55
- Object.defineProperty(exports, "__esModule", { value: true });
56
- __export(MaybeArray);
57
-
58
- });
59
-
60
- unwrapExports(arrays);
61
-
62
- var LazyPromise = createCommonjsModule(function (module, exports) {
63
- Object.defineProperty(exports, "__esModule", { value: true });
64
- function createLazyPromise() {
65
- const promise = Object.assign(new Promise((resolve, reject) => {
66
- promise.reject = reject;
67
- promise.resolve = resolve;
68
- }), {
69
- resolve() {
70
- throw new Error('pending resolve');
71
- },
72
- reject() {
73
- throw new Error('pending reject');
74
- },
75
- });
76
- return promise;
77
- }
78
- exports.createLazyPromise = createLazyPromise;
79
-
80
- });
81
-
82
- unwrapExports(LazyPromise);
83
- var LazyPromise_1 = LazyPromise.createLazyPromise;
84
-
85
- var AsyncInterval = createCommonjsModule(function (module, exports) {
86
- Object.defineProperty(exports, "__esModule", { value: true });
87
- function setAsyncInterval(cb, interval, initial = interval) {
88
- let id;
89
- const handler = async () => {
90
- await cb();
91
- id = setTimeout(handler, interval);
92
- };
93
- id = setTimeout(handler, initial);
94
- return () => id;
95
- }
96
- exports.setAsyncInterval = setAsyncInterval;
97
- function clearAsyncInterval(v) {
98
- clearTimeout(v === null || v === void 0 ? void 0 : v());
99
- }
100
- exports.clearAsyncInterval = clearAsyncInterval;
101
-
102
- });
103
-
104
- unwrapExports(AsyncInterval);
105
- var AsyncInterval_1 = AsyncInterval.setAsyncInterval;
106
- var AsyncInterval_2 = AsyncInterval.clearAsyncInterval;
107
-
108
- var sleep = createCommonjsModule(function (module, exports) {
109
- Object.defineProperty(exports, "__esModule", { value: true });
110
- exports.sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
111
-
112
- });
113
-
114
- unwrapExports(sleep);
115
- var sleep_1 = sleep.sleep;
116
-
117
- var asyncs = createCommonjsModule(function (module, exports) {
118
- function __export(m) {
119
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
120
- }
121
- Object.defineProperty(exports, "__esModule", { value: true });
122
- __export(LazyPromise);
123
- __export(AsyncInterval);
124
- __export(sleep);
125
-
126
- });
127
-
128
- unwrapExports(asyncs);
129
-
130
- var asserts = createCommonjsModule(function (module, exports) {
131
- Object.defineProperty(exports, "__esModule", { value: true });
132
- function assert(condition, msg) {
133
- // if (!condition) {
134
- // throw new AssertionError(msg);
135
- // }
136
- console.assert(!condition, msg);
137
- }
138
- exports.assert = assert;
139
- function assertIsDefined(val) {
140
- // if (val === undefined || val === null) {
141
- // throw new AssertionError(`Expected 'val' to be defined, but received ${val}`);
142
- // }
143
- console.assert(val === undefined || val === null, 'Expected defined');
144
- }
145
- exports.assertIsDefined = assertIsDefined;
146
-
147
- });
148
-
149
- unwrapExports(asserts);
150
- var asserts_1 = asserts.assert;
151
- var asserts_2 = asserts.assertIsDefined;
152
-
153
- var validations = createCommonjsModule(function (module, exports) {
154
- function __export(m) {
155
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
156
- }
157
- Object.defineProperty(exports, "__esModule", { value: true });
158
- __export(asserts);
159
-
160
- });
161
-
162
- unwrapExports(validations);
163
-
164
- var camelCase_1 = createCommonjsModule(function (module, exports) {
165
- // https://github.com/sindresorhus/camelcase/blob/master/index.js
166
- Object.defineProperty(exports, "__esModule", { value: true });
167
- function preserveCamelCase(string) {
168
- let isLastCharLower = false;
169
- let isLastCharUpper = false;
170
- let isLastLastCharUpper = false;
171
- for (let i = 0; i < string.length; i++) {
172
- const character = string[i];
173
- if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) {
174
- string = string.slice(0, i) + '-' + string.slice(i);
175
- isLastCharLower = false;
176
- isLastLastCharUpper = isLastCharUpper;
177
- isLastCharUpper = true;
178
- i++;
179
- }
180
- else if (isLastCharUpper &&
181
- isLastLastCharUpper &&
182
- /[a-zA-Z]/.test(character) &&
183
- character.toLowerCase() === character) {
184
- string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
185
- isLastLastCharUpper = isLastCharUpper;
186
- isLastCharUpper = false;
187
- isLastCharLower = true;
188
- }
189
- else {
190
- isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
191
- isLastLastCharUpper = isLastCharUpper;
192
- isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
193
- }
194
- }
195
- return string;
196
- }
197
- function pascalCase(input) {
198
- return camelCase(input, { pascalCase: true });
199
- }
200
- exports.pascalCase = pascalCase;
201
- function camelCase(input, options = {
202
- pascalCase: false
203
- }) {
204
- if (!(typeof input === 'string' || Array.isArray(input))) {
205
- throw new TypeError('Expected the input to be `string | string[]`');
206
- }
207
- const postProcess = (x) => (options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x);
208
- if (Array.isArray(input)) {
209
- input = input
210
- .map((x) => x.trim())
211
- .filter((x) => x.length)
212
- .join('-');
213
- }
214
- else {
215
- input = input.trim();
216
- }
217
- if (input.length === 0) {
218
- return '';
219
- }
220
- if (input.length === 1) {
221
- return options.pascalCase ? input.toUpperCase() : input.toLowerCase();
222
- }
223
- const hasUpperCase = input !== input.toLowerCase();
224
- if (hasUpperCase) {
225
- input = preserveCamelCase(input);
226
- }
227
- input = input
228
- .replace(/^[_.\- ]+/, '')
229
- .toLowerCase()
230
- .replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase())
231
- .replace(/\d+(\w|$)/g, (m) => m.toUpperCase());
232
- return postProcess(input);
233
- }
234
- exports.camelCase = camelCase;
235
-
236
- });
237
-
238
- unwrapExports(camelCase_1);
239
- var camelCase_2 = camelCase_1.pascalCase;
240
- var camelCase_3 = camelCase_1.camelCase;
241
-
242
- /**
243
- * Checks if `value` is classified as an `Array` object.
244
- *
245
- * @static
246
- * @memberOf _
247
- * @since 0.1.0
248
- * @category Lang
249
- * @param {*} value The value to check.
250
- * @returns {boolean} Returns `true` if `value` is an array, else `false`.
251
- * @example
252
- *
253
- * _.isArray([1, 2, 3]);
254
- * // => true
255
- *
256
- * _.isArray(document.body.children);
257
- * // => false
258
- *
259
- * _.isArray('abc');
260
- * // => false
261
- *
262
- * _.isArray(_.noop);
263
- * // => false
264
- */
265
- var isArray = Array.isArray;
266
-
267
- var isArray_1 = isArray;
268
-
269
- /** Detect free variable `global` from Node.js. */
270
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
271
-
272
- var _freeGlobal = freeGlobal;
273
-
274
- /** Detect free variable `self`. */
275
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
276
-
277
- /** Used as a reference to the global object. */
278
- var root = _freeGlobal || freeSelf || Function('return this')();
279
-
280
- var _root = root;
281
-
282
- /** Built-in value references. */
283
- var Symbol = _root.Symbol;
284
-
285
- var _Symbol = Symbol;
286
-
287
- /** Used for built-in method references. */
288
- var objectProto = Object.prototype;
289
-
290
- /** Used to check objects for own properties. */
291
- var hasOwnProperty = objectProto.hasOwnProperty;
292
-
293
- /**
294
- * Used to resolve the
295
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
296
- * of values.
297
- */
298
- var nativeObjectToString = objectProto.toString;
299
-
300
- /** Built-in value references. */
301
- var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
302
-
303
- /**
304
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
305
- *
306
- * @private
307
- * @param {*} value The value to query.
308
- * @returns {string} Returns the raw `toStringTag`.
309
- */
310
- function getRawTag(value) {
311
- var isOwn = hasOwnProperty.call(value, symToStringTag),
312
- tag = value[symToStringTag];
313
-
314
- try {
315
- value[symToStringTag] = undefined;
316
- var unmasked = true;
317
- } catch (e) {}
318
-
319
- var result = nativeObjectToString.call(value);
320
- if (unmasked) {
321
- if (isOwn) {
322
- value[symToStringTag] = tag;
323
- } else {
324
- delete value[symToStringTag];
325
- }
326
- }
327
- return result;
328
- }
329
-
330
- var _getRawTag = getRawTag;
331
-
332
- /** Used for built-in method references. */
333
- var objectProto$1 = Object.prototype;
334
-
335
- /**
336
- * Used to resolve the
337
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
338
- * of values.
339
- */
340
- var nativeObjectToString$1 = objectProto$1.toString;
341
-
342
- /**
343
- * Converts `value` to a string using `Object.prototype.toString`.
344
- *
345
- * @private
346
- * @param {*} value The value to convert.
347
- * @returns {string} Returns the converted string.
348
- */
349
- function objectToString(value) {
350
- return nativeObjectToString$1.call(value);
351
- }
352
-
353
- var _objectToString = objectToString;
354
-
355
- /** `Object#toString` result references. */
356
- var nullTag = '[object Null]',
357
- undefinedTag = '[object Undefined]';
358
-
359
- /** Built-in value references. */
360
- var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
361
-
362
- /**
363
- * The base implementation of `getTag` without fallbacks for buggy environments.
364
- *
365
- * @private
366
- * @param {*} value The value to query.
367
- * @returns {string} Returns the `toStringTag`.
368
- */
369
- function baseGetTag(value) {
370
- if (value == null) {
371
- return value === undefined ? undefinedTag : nullTag;
372
- }
373
- return (symToStringTag$1 && symToStringTag$1 in Object(value))
374
- ? _getRawTag(value)
375
- : _objectToString(value);
376
- }
377
-
378
- var _baseGetTag = baseGetTag;
379
-
380
- /**
381
- * Checks if `value` is object-like. A value is object-like if it's not `null`
382
- * and has a `typeof` result of "object".
383
- *
384
- * @static
385
- * @memberOf _
386
- * @since 4.0.0
387
- * @category Lang
388
- * @param {*} value The value to check.
389
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
390
- * @example
391
- *
392
- * _.isObjectLike({});
393
- * // => true
394
- *
395
- * _.isObjectLike([1, 2, 3]);
396
- * // => true
397
- *
398
- * _.isObjectLike(_.noop);
399
- * // => false
400
- *
401
- * _.isObjectLike(null);
402
- * // => false
403
- */
404
- function isObjectLike(value) {
405
- return value != null && typeof value == 'object';
406
- }
407
-
408
- var isObjectLike_1 = isObjectLike;
409
-
410
- /** `Object#toString` result references. */
411
- var symbolTag = '[object Symbol]';
412
-
413
- /**
414
- * Checks if `value` is classified as a `Symbol` primitive or object.
415
- *
416
- * @static
417
- * @memberOf _
418
- * @since 4.0.0
419
- * @category Lang
420
- * @param {*} value The value to check.
421
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
422
- * @example
423
- *
424
- * _.isSymbol(Symbol.iterator);
425
- * // => true
426
- *
427
- * _.isSymbol('abc');
428
- * // => false
429
- */
430
- function isSymbol(value) {
431
- return typeof value == 'symbol' ||
432
- (isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
433
- }
434
-
435
- var isSymbol_1 = isSymbol;
436
-
437
- /** Used to match property names within property paths. */
438
- var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
439
- reIsPlainProp = /^\w*$/;
440
-
441
- /**
442
- * Checks if `value` is a property name and not a property path.
443
- *
444
- * @private
445
- * @param {*} value The value to check.
446
- * @param {Object} [object] The object to query keys on.
447
- * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
448
- */
449
- function isKey(value, object) {
450
- if (isArray_1(value)) {
451
- return false;
452
- }
453
- var type = typeof value;
454
- if (type == 'number' || type == 'symbol' || type == 'boolean' ||
455
- value == null || isSymbol_1(value)) {
456
- return true;
457
- }
458
- return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
459
- (object != null && value in Object(object));
460
- }
461
-
462
- var _isKey = isKey;
463
-
464
- /**
465
- * Checks if `value` is the
466
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
467
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
468
- *
469
- * @static
470
- * @memberOf _
471
- * @since 0.1.0
472
- * @category Lang
473
- * @param {*} value The value to check.
474
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
475
- * @example
476
- *
477
- * _.isObject({});
478
- * // => true
479
- *
480
- * _.isObject([1, 2, 3]);
481
- * // => true
482
- *
483
- * _.isObject(_.noop);
484
- * // => true
485
- *
486
- * _.isObject(null);
487
- * // => false
488
- */
489
- function isObject(value) {
490
- var type = typeof value;
491
- return value != null && (type == 'object' || type == 'function');
492
- }
493
-
494
- var isObject_1 = isObject;
495
-
496
- /** `Object#toString` result references. */
497
- var asyncTag = '[object AsyncFunction]',
498
- funcTag = '[object Function]',
499
- genTag = '[object GeneratorFunction]',
500
- proxyTag = '[object Proxy]';
501
-
502
- /**
503
- * Checks if `value` is classified as a `Function` object.
504
- *
505
- * @static
506
- * @memberOf _
507
- * @since 0.1.0
508
- * @category Lang
509
- * @param {*} value The value to check.
510
- * @returns {boolean} Returns `true` if `value` is a function, else `false`.
511
- * @example
512
- *
513
- * _.isFunction(_);
514
- * // => true
515
- *
516
- * _.isFunction(/abc/);
517
- * // => false
518
- */
519
- function isFunction(value) {
520
- if (!isObject_1(value)) {
521
- return false;
522
- }
523
- // The use of `Object#toString` avoids issues with the `typeof` operator
524
- // in Safari 9 which returns 'object' for typed arrays and other constructors.
525
- var tag = _baseGetTag(value);
526
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
527
- }
528
-
529
- var isFunction_1 = isFunction;
530
-
531
- /** Used to detect overreaching core-js shims. */
532
- var coreJsData = _root['__core-js_shared__'];
533
-
534
- var _coreJsData = coreJsData;
535
-
536
- /** Used to detect methods masquerading as native. */
537
- var maskSrcKey = (function() {
538
- var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
539
- return uid ? ('Symbol(src)_1.' + uid) : '';
540
- }());
541
-
542
- /**
543
- * Checks if `func` has its source masked.
544
- *
545
- * @private
546
- * @param {Function} func The function to check.
547
- * @returns {boolean} Returns `true` if `func` is masked, else `false`.
548
- */
549
- function isMasked(func) {
550
- return !!maskSrcKey && (maskSrcKey in func);
551
- }
552
-
553
- var _isMasked = isMasked;
554
-
555
- /** Used for built-in method references. */
556
- var funcProto = Function.prototype;
557
-
558
- /** Used to resolve the decompiled source of functions. */
559
- var funcToString = funcProto.toString;
560
-
561
- /**
562
- * Converts `func` to its source code.
563
- *
564
- * @private
565
- * @param {Function} func The function to convert.
566
- * @returns {string} Returns the source code.
567
- */
568
- function toSource(func) {
569
- if (func != null) {
570
- try {
571
- return funcToString.call(func);
572
- } catch (e) {}
573
- try {
574
- return (func + '');
575
- } catch (e) {}
576
- }
577
- return '';
578
- }
579
-
580
- var _toSource = toSource;
581
-
582
- /**
583
- * Used to match `RegExp`
584
- * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
585
- */
586
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
587
-
588
- /** Used to detect host constructors (Safari). */
589
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
590
-
591
- /** Used for built-in method references. */
592
- var funcProto$1 = Function.prototype,
593
- objectProto$2 = Object.prototype;
594
-
595
- /** Used to resolve the decompiled source of functions. */
596
- var funcToString$1 = funcProto$1.toString;
597
-
598
- /** Used to check objects for own properties. */
599
- var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
600
-
601
- /** Used to detect if a method is native. */
602
- var reIsNative = RegExp('^' +
603
- funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
604
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
605
- );
606
-
607
- /**
608
- * The base implementation of `_.isNative` without bad shim checks.
609
- *
610
- * @private
611
- * @param {*} value The value to check.
612
- * @returns {boolean} Returns `true` if `value` is a native function,
613
- * else `false`.
614
- */
615
- function baseIsNative(value) {
616
- if (!isObject_1(value) || _isMasked(value)) {
617
- return false;
618
- }
619
- var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
620
- return pattern.test(_toSource(value));
621
- }
622
-
623
- var _baseIsNative = baseIsNative;
624
-
625
- /**
626
- * Gets the value at `key` of `object`.
627
- *
628
- * @private
629
- * @param {Object} [object] The object to query.
630
- * @param {string} key The key of the property to get.
631
- * @returns {*} Returns the property value.
632
- */
633
- function getValue(object, key) {
634
- return object == null ? undefined : object[key];
635
- }
636
-
637
- var _getValue = getValue;
638
-
639
- /**
640
- * Gets the native function at `key` of `object`.
641
- *
642
- * @private
643
- * @param {Object} object The object to query.
644
- * @param {string} key The key of the method to get.
645
- * @returns {*} Returns the function if it's native, else `undefined`.
646
- */
647
- function getNative(object, key) {
648
- var value = _getValue(object, key);
649
- return _baseIsNative(value) ? value : undefined;
650
- }
651
-
652
- var _getNative = getNative;
653
-
654
- /* Built-in method references that are verified to be native. */
655
- var nativeCreate = _getNative(Object, 'create');
656
-
657
- var _nativeCreate = nativeCreate;
658
-
659
- /**
660
- * Removes all key-value entries from the hash.
661
- *
662
- * @private
663
- * @name clear
664
- * @memberOf Hash
665
- */
666
- function hashClear() {
667
- this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
668
- this.size = 0;
669
- }
670
-
671
- var _hashClear = hashClear;
672
-
673
- /**
674
- * Removes `key` and its value from the hash.
675
- *
676
- * @private
677
- * @name delete
678
- * @memberOf Hash
679
- * @param {Object} hash The hash to modify.
680
- * @param {string} key The key of the value to remove.
681
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
682
- */
683
- function hashDelete(key) {
684
- var result = this.has(key) && delete this.__data__[key];
685
- this.size -= result ? 1 : 0;
686
- return result;
687
- }
688
-
689
- var _hashDelete = hashDelete;
690
-
691
- /** Used to stand-in for `undefined` hash values. */
692
- var HASH_UNDEFINED = '__lodash_hash_undefined__';
693
-
694
- /** Used for built-in method references. */
695
- var objectProto$3 = Object.prototype;
696
-
697
- /** Used to check objects for own properties. */
698
- var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
699
-
700
- /**
701
- * Gets the hash value for `key`.
702
- *
703
- * @private
704
- * @name get
705
- * @memberOf Hash
706
- * @param {string} key The key of the value to get.
707
- * @returns {*} Returns the entry value.
708
- */
709
- function hashGet(key) {
710
- var data = this.__data__;
711
- if (_nativeCreate) {
712
- var result = data[key];
713
- return result === HASH_UNDEFINED ? undefined : result;
714
- }
715
- return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
716
- }
717
-
718
- var _hashGet = hashGet;
719
-
720
- /** Used for built-in method references. */
721
- var objectProto$4 = Object.prototype;
722
-
723
- /** Used to check objects for own properties. */
724
- var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
725
-
726
- /**
727
- * Checks if a hash value for `key` exists.
728
- *
729
- * @private
730
- * @name has
731
- * @memberOf Hash
732
- * @param {string} key The key of the entry to check.
733
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
734
- */
735
- function hashHas(key) {
736
- var data = this.__data__;
737
- return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
738
- }
739
-
740
- var _hashHas = hashHas;
741
-
742
- /** Used to stand-in for `undefined` hash values. */
743
- var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
744
-
745
- /**
746
- * Sets the hash `key` to `value`.
747
- *
748
- * @private
749
- * @name set
750
- * @memberOf Hash
751
- * @param {string} key The key of the value to set.
752
- * @param {*} value The value to set.
753
- * @returns {Object} Returns the hash instance.
754
- */
755
- function hashSet(key, value) {
756
- var data = this.__data__;
757
- this.size += this.has(key) ? 0 : 1;
758
- data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
759
- return this;
760
- }
761
-
762
- var _hashSet = hashSet;
763
-
764
- /**
765
- * Creates a hash object.
766
- *
767
- * @private
768
- * @constructor
769
- * @param {Array} [entries] The key-value pairs to cache.
770
- */
771
- function Hash(entries) {
772
- var index = -1,
773
- length = entries == null ? 0 : entries.length;
774
-
775
- this.clear();
776
- while (++index < length) {
777
- var entry = entries[index];
778
- this.set(entry[0], entry[1]);
779
- }
780
- }
781
-
782
- // Add methods to `Hash`.
783
- Hash.prototype.clear = _hashClear;
784
- Hash.prototype['delete'] = _hashDelete;
785
- Hash.prototype.get = _hashGet;
786
- Hash.prototype.has = _hashHas;
787
- Hash.prototype.set = _hashSet;
788
-
789
- var _Hash = Hash;
790
-
791
- /**
792
- * Removes all key-value entries from the list cache.
793
- *
794
- * @private
795
- * @name clear
796
- * @memberOf ListCache
797
- */
798
- function listCacheClear() {
799
- this.__data__ = [];
800
- this.size = 0;
801
- }
802
-
803
- var _listCacheClear = listCacheClear;
804
-
805
- /**
806
- * Performs a
807
- * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
808
- * comparison between two values to determine if they are equivalent.
809
- *
810
- * @static
811
- * @memberOf _
812
- * @since 4.0.0
813
- * @category Lang
814
- * @param {*} value The value to compare.
815
- * @param {*} other The other value to compare.
816
- * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
817
- * @example
818
- *
819
- * var object = { 'a': 1 };
820
- * var other = { 'a': 1 };
821
- *
822
- * _.eq(object, object);
823
- * // => true
824
- *
825
- * _.eq(object, other);
826
- * // => false
827
- *
828
- * _.eq('a', 'a');
829
- * // => true
830
- *
831
- * _.eq('a', Object('a'));
832
- * // => false
833
- *
834
- * _.eq(NaN, NaN);
835
- * // => true
836
- */
837
- function eq(value, other) {
838
- return value === other || (value !== value && other !== other);
839
- }
840
-
841
- var eq_1 = eq;
842
-
843
- /**
844
- * Gets the index at which the `key` is found in `array` of key-value pairs.
845
- *
846
- * @private
847
- * @param {Array} array The array to inspect.
848
- * @param {*} key The key to search for.
849
- * @returns {number} Returns the index of the matched value, else `-1`.
850
- */
851
- function assocIndexOf(array, key) {
852
- var length = array.length;
853
- while (length--) {
854
- if (eq_1(array[length][0], key)) {
855
- return length;
856
- }
857
- }
858
- return -1;
859
- }
860
-
861
- var _assocIndexOf = assocIndexOf;
862
-
863
- /** Used for built-in method references. */
864
- var arrayProto = Array.prototype;
865
-
866
- /** Built-in value references. */
867
- var splice = arrayProto.splice;
868
-
869
- /**
870
- * Removes `key` and its value from the list cache.
871
- *
872
- * @private
873
- * @name delete
874
- * @memberOf ListCache
875
- * @param {string} key The key of the value to remove.
876
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
877
- */
878
- function listCacheDelete(key) {
879
- var data = this.__data__,
880
- index = _assocIndexOf(data, key);
881
-
882
- if (index < 0) {
883
- return false;
884
- }
885
- var lastIndex = data.length - 1;
886
- if (index == lastIndex) {
887
- data.pop();
888
- } else {
889
- splice.call(data, index, 1);
890
- }
891
- --this.size;
892
- return true;
893
- }
894
-
895
- var _listCacheDelete = listCacheDelete;
896
-
897
- /**
898
- * Gets the list cache value for `key`.
899
- *
900
- * @private
901
- * @name get
902
- * @memberOf ListCache
903
- * @param {string} key The key of the value to get.
904
- * @returns {*} Returns the entry value.
905
- */
906
- function listCacheGet(key) {
907
- var data = this.__data__,
908
- index = _assocIndexOf(data, key);
909
-
910
- return index < 0 ? undefined : data[index][1];
911
- }
912
-
913
- var _listCacheGet = listCacheGet;
914
-
915
- /**
916
- * Checks if a list cache value for `key` exists.
917
- *
918
- * @private
919
- * @name has
920
- * @memberOf ListCache
921
- * @param {string} key The key of the entry to check.
922
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
923
- */
924
- function listCacheHas(key) {
925
- return _assocIndexOf(this.__data__, key) > -1;
926
- }
927
-
928
- var _listCacheHas = listCacheHas;
929
-
930
- /**
931
- * Sets the list cache `key` to `value`.
932
- *
933
- * @private
934
- * @name set
935
- * @memberOf ListCache
936
- * @param {string} key The key of the value to set.
937
- * @param {*} value The value to set.
938
- * @returns {Object} Returns the list cache instance.
939
- */
940
- function listCacheSet(key, value) {
941
- var data = this.__data__,
942
- index = _assocIndexOf(data, key);
943
-
944
- if (index < 0) {
945
- ++this.size;
946
- data.push([key, value]);
947
- } else {
948
- data[index][1] = value;
949
- }
950
- return this;
951
- }
952
-
953
- var _listCacheSet = listCacheSet;
954
-
955
- /**
956
- * Creates an list cache object.
957
- *
958
- * @private
959
- * @constructor
960
- * @param {Array} [entries] The key-value pairs to cache.
961
- */
962
- function ListCache(entries) {
963
- var index = -1,
964
- length = entries == null ? 0 : entries.length;
965
-
966
- this.clear();
967
- while (++index < length) {
968
- var entry = entries[index];
969
- this.set(entry[0], entry[1]);
970
- }
971
- }
972
-
973
- // Add methods to `ListCache`.
974
- ListCache.prototype.clear = _listCacheClear;
975
- ListCache.prototype['delete'] = _listCacheDelete;
976
- ListCache.prototype.get = _listCacheGet;
977
- ListCache.prototype.has = _listCacheHas;
978
- ListCache.prototype.set = _listCacheSet;
979
-
980
- var _ListCache = ListCache;
981
-
982
- /* Built-in method references that are verified to be native. */
983
- var Map = _getNative(_root, 'Map');
984
-
985
- var _Map = Map;
986
-
987
- /**
988
- * Removes all key-value entries from the map.
989
- *
990
- * @private
991
- * @name clear
992
- * @memberOf MapCache
993
- */
994
- function mapCacheClear() {
995
- this.size = 0;
996
- this.__data__ = {
997
- 'hash': new _Hash,
998
- 'map': new (_Map || _ListCache),
999
- 'string': new _Hash
1000
- };
1001
- }
1002
-
1003
- var _mapCacheClear = mapCacheClear;
1004
-
1005
- /**
1006
- * Checks if `value` is suitable for use as unique object key.
1007
- *
1008
- * @private
1009
- * @param {*} value The value to check.
1010
- * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
1011
- */
1012
- function isKeyable(value) {
1013
- var type = typeof value;
1014
- return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
1015
- ? (value !== '__proto__')
1016
- : (value === null);
1017
- }
1018
-
1019
- var _isKeyable = isKeyable;
1020
-
1021
- /**
1022
- * Gets the data for `map`.
1023
- *
1024
- * @private
1025
- * @param {Object} map The map to query.
1026
- * @param {string} key The reference key.
1027
- * @returns {*} Returns the map data.
1028
- */
1029
- function getMapData(map, key) {
1030
- var data = map.__data__;
1031
- return _isKeyable(key)
1032
- ? data[typeof key == 'string' ? 'string' : 'hash']
1033
- : data.map;
1034
- }
1035
-
1036
- var _getMapData = getMapData;
1037
-
1038
- /**
1039
- * Removes `key` and its value from the map.
1040
- *
1041
- * @private
1042
- * @name delete
1043
- * @memberOf MapCache
1044
- * @param {string} key The key of the value to remove.
1045
- * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1046
- */
1047
- function mapCacheDelete(key) {
1048
- var result = _getMapData(this, key)['delete'](key);
1049
- this.size -= result ? 1 : 0;
1050
- return result;
1051
- }
1052
-
1053
- var _mapCacheDelete = mapCacheDelete;
1054
-
1055
- /**
1056
- * Gets the map value for `key`.
1057
- *
1058
- * @private
1059
- * @name get
1060
- * @memberOf MapCache
1061
- * @param {string} key The key of the value to get.
1062
- * @returns {*} Returns the entry value.
1063
- */
1064
- function mapCacheGet(key) {
1065
- return _getMapData(this, key).get(key);
1066
- }
1067
-
1068
- var _mapCacheGet = mapCacheGet;
1069
-
1070
- /**
1071
- * Checks if a map value for `key` exists.
1072
- *
1073
- * @private
1074
- * @name has
1075
- * @memberOf MapCache
1076
- * @param {string} key The key of the entry to check.
1077
- * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1078
- */
1079
- function mapCacheHas(key) {
1080
- return _getMapData(this, key).has(key);
1081
- }
1082
-
1083
- var _mapCacheHas = mapCacheHas;
1084
-
1085
- /**
1086
- * Sets the map `key` to `value`.
1087
- *
1088
- * @private
1089
- * @name set
1090
- * @memberOf MapCache
1091
- * @param {string} key The key of the value to set.
1092
- * @param {*} value The value to set.
1093
- * @returns {Object} Returns the map cache instance.
1094
- */
1095
- function mapCacheSet(key, value) {
1096
- var data = _getMapData(this, key),
1097
- size = data.size;
1098
-
1099
- data.set(key, value);
1100
- this.size += data.size == size ? 0 : 1;
1101
- return this;
1102
- }
1103
-
1104
- var _mapCacheSet = mapCacheSet;
1105
-
1106
- /**
1107
- * Creates a map cache object to store key-value pairs.
1108
- *
1109
- * @private
1110
- * @constructor
1111
- * @param {Array} [entries] The key-value pairs to cache.
1112
- */
1113
- function MapCache(entries) {
1114
- var index = -1,
1115
- length = entries == null ? 0 : entries.length;
1116
-
1117
- this.clear();
1118
- while (++index < length) {
1119
- var entry = entries[index];
1120
- this.set(entry[0], entry[1]);
1121
- }
1122
- }
1123
-
1124
- // Add methods to `MapCache`.
1125
- MapCache.prototype.clear = _mapCacheClear;
1126
- MapCache.prototype['delete'] = _mapCacheDelete;
1127
- MapCache.prototype.get = _mapCacheGet;
1128
- MapCache.prototype.has = _mapCacheHas;
1129
- MapCache.prototype.set = _mapCacheSet;
1130
-
1131
- var _MapCache = MapCache;
1132
-
1133
- /** Error message constants. */
1134
- var FUNC_ERROR_TEXT = 'Expected a function';
1135
-
1136
- /**
1137
- * Creates a function that memoizes the result of `func`. If `resolver` is
1138
- * provided, it determines the cache key for storing the result based on the
1139
- * arguments provided to the memoized function. By default, the first argument
1140
- * provided to the memoized function is used as the map cache key. The `func`
1141
- * is invoked with the `this` binding of the memoized function.
1142
- *
1143
- * **Note:** The cache is exposed as the `cache` property on the memoized
1144
- * function. Its creation may be customized by replacing the `_.memoize.Cache`
1145
- * constructor with one whose instances implement the
1146
- * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
1147
- * method interface of `clear`, `delete`, `get`, `has`, and `set`.
1148
- *
1149
- * @static
1150
- * @memberOf _
1151
- * @since 0.1.0
1152
- * @category Function
1153
- * @param {Function} func The function to have its output memoized.
1154
- * @param {Function} [resolver] The function to resolve the cache key.
1155
- * @returns {Function} Returns the new memoized function.
1156
- * @example
1157
- *
1158
- * var object = { 'a': 1, 'b': 2 };
1159
- * var other = { 'c': 3, 'd': 4 };
1160
- *
1161
- * var values = _.memoize(_.values);
1162
- * values(object);
1163
- * // => [1, 2]
1164
- *
1165
- * values(other);
1166
- * // => [3, 4]
1167
- *
1168
- * object.a = 2;
1169
- * values(object);
1170
- * // => [1, 2]
1171
- *
1172
- * // Modify the result cache.
1173
- * values.cache.set(object, ['a', 'b']);
1174
- * values(object);
1175
- * // => ['a', 'b']
1176
- *
1177
- * // Replace `_.memoize.Cache`.
1178
- * _.memoize.Cache = WeakMap;
1179
- */
1180
- function memoize(func, resolver) {
1181
- if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
1182
- throw new TypeError(FUNC_ERROR_TEXT);
1183
- }
1184
- var memoized = function() {
1185
- var args = arguments,
1186
- key = resolver ? resolver.apply(this, args) : args[0],
1187
- cache = memoized.cache;
1188
-
1189
- if (cache.has(key)) {
1190
- return cache.get(key);
1191
- }
1192
- var result = func.apply(this, args);
1193
- memoized.cache = cache.set(key, result) || cache;
1194
- return result;
1195
- };
1196
- memoized.cache = new (memoize.Cache || _MapCache);
1197
- return memoized;
1198
- }
1199
-
1200
- // Expose `MapCache`.
1201
- memoize.Cache = _MapCache;
1202
-
1203
- var memoize_1 = memoize;
1204
-
1205
- /** Used as the maximum memoize cache size. */
1206
- var MAX_MEMOIZE_SIZE = 500;
1207
-
1208
- /**
1209
- * A specialized version of `_.memoize` which clears the memoized function's
1210
- * cache when it exceeds `MAX_MEMOIZE_SIZE`.
1211
- *
1212
- * @private
1213
- * @param {Function} func The function to have its output memoized.
1214
- * @returns {Function} Returns the new memoized function.
1215
- */
1216
- function memoizeCapped(func) {
1217
- var result = memoize_1(func, function(key) {
1218
- if (cache.size === MAX_MEMOIZE_SIZE) {
1219
- cache.clear();
1220
- }
1221
- return key;
1222
- });
1223
-
1224
- var cache = result.cache;
1225
- return result;
1226
- }
1227
-
1228
- var _memoizeCapped = memoizeCapped;
1229
-
1230
- /** Used to match property names within property paths. */
1231
- var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
1232
-
1233
- /** Used to match backslashes in property paths. */
1234
- var reEscapeChar = /\\(\\)?/g;
1235
-
1236
- /**
1237
- * Converts `string` to a property path array.
1238
- *
1239
- * @private
1240
- * @param {string} string The string to convert.
1241
- * @returns {Array} Returns the property path array.
1242
- */
1243
- var stringToPath = _memoizeCapped(function(string) {
1244
- var result = [];
1245
- if (string.charCodeAt(0) === 46 /* . */) {
1246
- result.push('');
1247
- }
1248
- string.replace(rePropName, function(match, number, quote, subString) {
1249
- result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
1250
- });
1251
- return result;
1252
- });
1253
-
1254
- var _stringToPath = stringToPath;
1255
-
1256
- /**
1257
- * A specialized version of `_.map` for arrays without support for iteratee
1258
- * shorthands.
1259
- *
1260
- * @private
1261
- * @param {Array} [array] The array to iterate over.
1262
- * @param {Function} iteratee The function invoked per iteration.
1263
- * @returns {Array} Returns the new mapped array.
1264
- */
1265
- function arrayMap(array, iteratee) {
1266
- var index = -1,
1267
- length = array == null ? 0 : array.length,
1268
- result = Array(length);
1269
-
1270
- while (++index < length) {
1271
- result[index] = iteratee(array[index], index, array);
1272
- }
1273
- return result;
1274
- }
1275
-
1276
- var _arrayMap = arrayMap;
1277
-
1278
- /** Used as references for various `Number` constants. */
1279
- var INFINITY = 1 / 0;
1280
-
1281
- /** Used to convert symbols to primitives and strings. */
1282
- var symbolProto = _Symbol ? _Symbol.prototype : undefined,
1283
- symbolToString = symbolProto ? symbolProto.toString : undefined;
1284
-
1285
- /**
1286
- * The base implementation of `_.toString` which doesn't convert nullish
1287
- * values to empty strings.
1288
- *
1289
- * @private
1290
- * @param {*} value The value to process.
1291
- * @returns {string} Returns the string.
1292
- */
1293
- function baseToString(value) {
1294
- // Exit early for strings to avoid a performance hit in some environments.
1295
- if (typeof value == 'string') {
1296
- return value;
1297
- }
1298
- if (isArray_1(value)) {
1299
- // Recursively convert values (susceptible to call stack limits).
1300
- return _arrayMap(value, baseToString) + '';
1301
- }
1302
- if (isSymbol_1(value)) {
1303
- return symbolToString ? symbolToString.call(value) : '';
1304
- }
1305
- var result = (value + '');
1306
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
1307
- }
1308
-
1309
- var _baseToString = baseToString;
1310
-
1311
- /**
1312
- * Converts `value` to a string. An empty string is returned for `null`
1313
- * and `undefined` values. The sign of `-0` is preserved.
1314
- *
1315
- * @static
1316
- * @memberOf _
1317
- * @since 4.0.0
1318
- * @category Lang
1319
- * @param {*} value The value to convert.
1320
- * @returns {string} Returns the converted string.
1321
- * @example
1322
- *
1323
- * _.toString(null);
1324
- * // => ''
1325
- *
1326
- * _.toString(-0);
1327
- * // => '-0'
1328
- *
1329
- * _.toString([1, 2, 3]);
1330
- * // => '1,2,3'
1331
- */
1332
- function toString(value) {
1333
- return value == null ? '' : _baseToString(value);
1334
- }
1335
-
1336
- var toString_1 = toString;
1337
-
1338
- /**
1339
- * Casts `value` to a path array if it's not one.
1340
- *
1341
- * @private
1342
- * @param {*} value The value to inspect.
1343
- * @param {Object} [object] The object to query keys on.
1344
- * @returns {Array} Returns the cast property path array.
1345
- */
1346
- function castPath(value, object) {
1347
- if (isArray_1(value)) {
1348
- return value;
1349
- }
1350
- return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
1351
- }
1352
-
1353
- var _castPath = castPath;
1354
-
1355
- /** Used as references for various `Number` constants. */
1356
- var INFINITY$1 = 1 / 0;
1357
-
1358
- /**
1359
- * Converts `value` to a string key if it's not a string or symbol.
1360
- *
1361
- * @private
1362
- * @param {*} value The value to inspect.
1363
- * @returns {string|symbol} Returns the key.
1364
- */
1365
- function toKey(value) {
1366
- if (typeof value == 'string' || isSymbol_1(value)) {
1367
- return value;
1368
- }
1369
- var result = (value + '');
1370
- return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
1371
- }
1372
-
1373
- var _toKey = toKey;
1374
-
1375
- /**
1376
- * The base implementation of `_.get` without support for default values.
1377
- *
1378
- * @private
1379
- * @param {Object} object The object to query.
1380
- * @param {Array|string} path The path of the property to get.
1381
- * @returns {*} Returns the resolved value.
1382
- */
1383
- function baseGet(object, path) {
1384
- path = _castPath(path, object);
1385
-
1386
- var index = 0,
1387
- length = path.length;
1388
-
1389
- while (object != null && index < length) {
1390
- object = object[_toKey(path[index++])];
1391
- }
1392
- return (index && index == length) ? object : undefined;
1393
- }
1394
-
1395
- var _baseGet = baseGet;
1396
-
1397
- /**
1398
- * Gets the value at `path` of `object`. If the resolved value is
1399
- * `undefined`, the `defaultValue` is returned in its place.
1400
- *
1401
- * @static
1402
- * @memberOf _
1403
- * @since 3.7.0
1404
- * @category Object
1405
- * @param {Object} object The object to query.
1406
- * @param {Array|string} path The path of the property to get.
1407
- * @param {*} [defaultValue] The value returned for `undefined` resolved values.
1408
- * @returns {*} Returns the resolved value.
1409
- * @example
1410
- *
1411
- * var object = { 'a': [{ 'b': { 'c': 3 } }] };
1412
- *
1413
- * _.get(object, 'a[0].b.c');
1414
- * // => 3
1415
- *
1416
- * _.get(object, ['a', '0', 'b', 'c']);
1417
- * // => 3
1418
- *
1419
- * _.get(object, 'a.b.c', 'default');
1420
- * // => 'default'
1421
- */
1422
- function get(object, path, defaultValue) {
1423
- var result = object == null ? undefined : _baseGet(object, path);
1424
- return result === undefined ? defaultValue : result;
1425
- }
1426
-
1427
- var get_1 = get;
1428
-
1429
- var templates = createCommonjsModule(function (module, exports) {
1430
- Object.defineProperty(exports, "__esModule", { value: true });
1431
-
1432
- /**
1433
- * 替换类似于 JS 的模板字符串
1434
- *
1435
- * @example
1436
- * templateString('My name is ${name}',{name:'wener'})
1437
- */
1438
- function templateString(template, variables) {
1439
- return template.replace(/\${(.*?)}/g, (_, g) => {
1440
- // variables[g.trim()]
1441
- // 支持路径 - 例如 a.b[0]
1442
- return get_1.default(variables, g.trim());
1443
- });
1444
- }
1445
- exports.templateString = templateString;
1446
-
1447
- });
1448
-
1449
- unwrapExports(templates);
1450
- var templates_1 = templates.templateString;
1451
-
1452
- var strings = createCommonjsModule(function (module, exports) {
1453
- function __export(m) {
1454
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
1455
- }
1456
- Object.defineProperty(exports, "__esModule", { value: true });
1457
- __export(camelCase_1);
1458
- __export(templates);
1459
-
1460
- });
1461
-
1462
- unwrapExports(strings);
1463
-
1464
- var random = createCommonjsModule(function (module, exports) {
1465
- Object.defineProperty(exports, "__esModule", { value: true });
1466
- /// javascript pseudo random
1467
- function createRandom({ seed = 0 } = {}) {
1468
- if (typeof seed === 'string') {
1469
- const s = seed;
1470
- let sum = 0;
1471
- for (let i = 0; i < s.length; i++) {
1472
- sum += s.charCodeAt(i);
1473
- }
1474
- seed = sum;
1475
- }
1476
- return () => {
1477
- const x = Math.sin(seed++) * 10000;
1478
- return x - Math.floor(x);
1479
- };
1480
- }
1481
- exports.createRandom = createRandom;
1482
-
1483
- });
1484
-
1485
- unwrapExports(random);
1486
- var random_1 = random.createRandom;
1487
-
1488
- var maths = createCommonjsModule(function (module, exports) {
1489
- function __export(m) {
1490
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
1491
- }
1492
- Object.defineProperty(exports, "__esModule", { value: true });
1493
- __export(random);
1494
-
1495
- });
1496
-
1497
- unwrapExports(maths);
1498
-
1499
- var isBuffer_1 = createCommonjsModule(function (module, exports) {
1500
- Object.defineProperty(exports, "__esModule", { value: true });
1501
- // https://github.com/feross/is-buffer/blob/master/index.js
1502
- function isBuffer(obj) {
1503
- return (obj != null &&
1504
- obj.constructor != null &&
1505
- typeof obj.constructor.isBuffer === 'function' &&
1506
- obj.constructor.isBuffer(obj));
1507
- }
1508
- exports.isBuffer = isBuffer;
1509
-
1510
- });
1511
-
1512
- unwrapExports(isBuffer_1);
1513
- var isBuffer_2 = isBuffer_1.isBuffer;
1514
-
1515
- var io = createCommonjsModule(function (module, exports) {
1516
- function __export(m) {
1517
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
1518
- }
1519
- Object.defineProperty(exports, "__esModule", { value: true });
1520
- __export(isBuffer_1);
1521
-
1522
- });
1523
-
1524
- unwrapExports(io);
1525
-
1526
- var isDev = createCommonjsModule(function (module, exports) {
1527
- Object.defineProperty(exports, "__esModule", { value: true });
1528
- exports.isDev = () => { var _a; return (((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.NODE_ENV) || '').startsWith('dev'); };
1529
-
1530
- });
1531
-
1532
- unwrapExports(isDev);
1533
- var isDev_1 = isDev.isDev;
1534
-
1535
- var envs = createCommonjsModule(function (module, exports) {
1536
- function __export(m) {
1537
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
1538
- }
1539
- Object.defineProperty(exports, "__esModule", { value: true });
1540
- __export(isDev);
1541
-
1542
- });
1543
-
1544
- unwrapExports(envs);
1545
-
1546
- var clipboard = createCommonjsModule(function (module, exports) {
1547
- Object.defineProperty(exports, "__esModule", { value: true });
1548
- // https://gist.github.com/rproenca/64781c6a1329b48a455b645d361a9aa3
1549
- let _copy;
1550
- function initCopy() {
1551
- let textArea;
1552
- function isIOS() {
1553
- return navigator.userAgent.match(/ipad|iphone/i);
1554
- }
1555
- function createTextArea(text) {
1556
- textArea = document.createElement('textArea');
1557
- textArea.value = text;
1558
- document.body.appendChild(textArea);
1559
- }
1560
- function selectText() {
1561
- let range, selection;
1562
- if (isIOS()) {
1563
- range = document.createRange();
1564
- range.selectNodeContents(textArea);
1565
- selection = window.getSelection();
1566
- if (selection === null) {
1567
- console.error(`no selection`);
1568
- return;
1569
- }
1570
- selection.removeAllRanges();
1571
- selection.addRange(range);
1572
- textArea.setSelectionRange(0, 999999);
1573
- }
1574
- else {
1575
- textArea.select();
1576
- }
1577
- }
1578
- function copyToClipboard() {
1579
- document.execCommand('copy');
1580
- document.body.removeChild(textArea);
1581
- }
1582
- _copy = (text) => {
1583
- createTextArea(text);
1584
- selectText();
1585
- copyToClipboard();
1586
- };
1587
- }
1588
- function copy(text) {
1589
- var _a, _b;
1590
- if ((_b = (_a = window.navigator) === null || _a === void 0 ? void 0 : _a.clipboard) === null || _b === void 0 ? void 0 : _b.writeText) {
1591
- window.navigator.clipboard.writeText(text);
1592
- return;
1593
- }
1594
- if (!_copy) {
1595
- initCopy();
1596
- }
1597
- _copy(text);
1598
- }
1599
- exports.copy = copy;
1600
-
1601
- });
1602
-
1603
- unwrapExports(clipboard);
1604
- var clipboard_1 = clipboard.copy;
1605
-
1606
- var download_1 = createCommonjsModule(function (module, exports) {
1607
- Object.defineProperty(exports, "__esModule", { value: true });
1608
- function download(filename, data, { type = 'application/octet-stream', raw = false } = {}) {
1609
- const a = document.createElement('a');
1610
- let closer = () => null;
1611
- try {
1612
- a.download = filename;
1613
- // console.info(`downloading ${name}`, data);
1614
- // url or data url
1615
- if (typeof data === 'string' && /^(https?:|data:)/.test(data) && !raw) {
1616
- a.href = data;
1617
- }
1618
- else if (typeof data === 'string') {
1619
- data = new TextEncoder().encode(data);
1620
- }
1621
- if (data instanceof Uint8Array) {
1622
- data = new Blob([data], { type });
1623
- }
1624
- if (data instanceof File || data instanceof Blob || data instanceof MediaSource) {
1625
- a.href = URL.createObjectURL(data);
1626
- closer = () => URL.revokeObjectURL(a.href);
1627
- }
1628
- else {
1629
- console.error(`invalid download data`, data);
1630
- throw new Error(`can not download ${Object.getPrototypeOf(data)}`);
1631
- }
1632
- a.click();
1633
- }
1634
- finally {
1635
- closer();
1636
- }
1637
- }
1638
- exports.download = download;
1639
-
1640
- });
1641
-
1642
- unwrapExports(download_1);
1643
- var download_2 = download_1.download;
1644
-
1645
- var loaders = createCommonjsModule(function (module, exports) {
1646
- Object.defineProperty(exports, "__esModule", { value: true });
1647
- function load(el, resolve, reject, options) {
1648
- el.onload = resolve;
1649
- el.onerror = (e) => {
1650
- el.remove();
1651
- reject(e);
1652
- };
1653
- const { attributes = {} } = options || {};
1654
- Object.entries(attributes).forEach(([k, v]) => el.setAttribute(k, v));
1655
- document.head.appendChild(el);
1656
- }
1657
- function loadScripts(src, options) {
1658
- // todo quote ?
1659
- if (document.querySelector(`script[src="${src}"]`)) {
1660
- return Promise.resolve();
1661
- }
1662
- return new Promise((resolve, reject) => {
1663
- const el = document.createElement('script');
1664
- el.src = src;
1665
- load(el, resolve, reject, options);
1666
- });
1667
- }
1668
- exports.loadScripts = loadScripts;
1669
- function loadStyles(href, options) {
1670
- if (document.querySelector(`link[link="${href}"]`)) {
1671
- return Promise.resolve();
1672
- }
1673
- return new Promise((resolve, reject) => {
1674
- const el = document.createElement('link');
1675
- el.rel = 'stylesheet';
1676
- el.href = href;
1677
- load(el, resolve, reject, options);
1678
- });
1679
- }
1680
- exports.loadStyles = loadStyles;
1681
-
1682
- });
1683
-
1684
- unwrapExports(loaders);
1685
- var loaders_1 = loaders.loadScripts;
1686
- var loaders_2 = loaders.loadStyles;
1687
-
1688
- var transfers = createCommonjsModule(function (module, exports) {
1689
- Object.defineProperty(exports, "__esModule", { value: true });
1690
- function getFile(dataTransfer) {
1691
- var _a, _b, _c;
1692
- const items = (_a = dataTransfer === null || dataTransfer === void 0 ? void 0 : dataTransfer.items) !== null && _a !== void 0 ? _a : [];
1693
- if (items.length >= 2 && items[0].kind === 'string' && items[1].kind === 'file') {
1694
- const text = dataTransfer.getData('text');
1695
- const file = (_b = items[1].getAsFile()) !== null && _b !== void 0 ? _b : (_c = dataTransfer.files) === null || _c === void 0 ? void 0 : _c.item(0);
1696
- if (!file) {
1697
- console.error(`no file ${text}`, items[1]);
1698
- return null;
1699
- }
1700
- // let type = file.type;
1701
- // // fix type
1702
- // type = type;
1703
- // // NOTE paste file can not parse by libs
1704
- // if (type !== file.type) {
1705
- // const blob = file.slice(0, file.size);
1706
- // file = new File([blob], text, {type});
1707
- // }
1708
- return { file, filename: text };
1709
- }
1710
- else if (items[0].kind === 'file') {
1711
- const file = items[0].getAsFile();
1712
- if (!file) {
1713
- console.error(`no file`, items[0]);
1714
- return null;
1715
- }
1716
- return { file, filename: file.name };
1717
- }
1718
- else {
1719
- console.debug(`file item not match`, Array.from(items).map((v) => ({ type: v.type, kind: v.kind })));
1720
- }
1721
- return null;
1722
- }
1723
- exports.getFile = getFile;
1724
-
1725
- });
1726
-
1727
- unwrapExports(transfers);
1728
- var transfers_1 = transfers.getFile;
1729
-
1730
- var browsers = createCommonjsModule(function (module, exports) {
1731
- function __export(m) {
1732
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
1733
- }
1734
- Object.defineProperty(exports, "__esModule", { value: true });
1735
- __export(clipboard);
1736
- __export(download_1);
1737
- __export(loaders);
1738
- __export(transfers);
1739
-
1740
- });
1741
-
1742
- unwrapExports(browsers);
1743
-
1744
- var lib = createCommonjsModule(function (module, exports) {
1745
- function __export(m) {
1746
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
1747
- }
1748
- Object.defineProperty(exports, "__esModule", { value: true });
1749
- __export(arrays);
1750
- __export(asyncs);
1751
- __export(validations);
1752
- __export(strings);
1753
- __export(maths);
1754
- __export(io);
1755
- __export(envs);
1756
- exports.Browsers = browsers;
1757
-
1758
- });
1759
-
1760
- var index = unwrapExports(lib);
1761
- var lib_1 = lib.Browsers;
1762
-
1763
- exports.Browsers = lib_1;
1764
- exports.default = index;
1765
-
1766
- Object.defineProperty(exports, '__esModule', { value: true });
1767
-
1768
- })));
1769
- //# sourceMappingURL=utils.umd.js.map