yummies 5.7.1 → 5.9.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 (434) hide show
  1. package/async.cjs +2 -70
  2. package/async.cjs.map +1 -0
  3. package/async.js +26 -59
  4. package/async.js.map +1 -0
  5. package/common.cjs +2 -18
  6. package/common.cjs.map +1 -0
  7. package/common.d.ts +1 -1
  8. package/common.d.ts.map +1 -1
  9. package/common.js +5 -13
  10. package/common.js.map +1 -0
  11. package/complex/global-config.d.ts +1 -1
  12. package/complex/global-config.d.ts.map +1 -1
  13. package/complex/index.d.ts +3 -3
  14. package/complex/index.d.ts.map +1 -1
  15. package/complex/modules-factory.d.ts +1 -1
  16. package/complex/modules-factory.d.ts.map +1 -1
  17. package/complex.cjs +2 -0
  18. package/complex.cjs.map +1 -0
  19. package/complex.js +66 -0
  20. package/complex.js.map +1 -0
  21. package/cookie.cjs +2 -13
  22. package/cookie.cjs.map +1 -0
  23. package/cookie.d.ts +1 -1
  24. package/cookie.d.ts.map +1 -1
  25. package/cookie.js +4 -8
  26. package/cookie.js.map +1 -0
  27. package/css.cjs +2 -64
  28. package/css.cjs.map +1 -0
  29. package/css.d.ts +1 -1
  30. package/css.js +24 -54
  31. package/css.js.map +1 -0
  32. package/data.cjs +2 -58
  33. package/data.cjs.map +1 -0
  34. package/data.js +32 -50
  35. package/data.js.map +1 -0
  36. package/date-time.cjs +2 -171
  37. package/date-time.cjs.map +1 -0
  38. package/date-time.d.ts +2 -3
  39. package/date-time.d.ts.map +1 -1
  40. package/date-time.js +311 -156
  41. package/date-time.js.map +1 -0
  42. package/device.cjs +2 -28
  43. package/device.cjs.map +1 -0
  44. package/device.js +23 -20
  45. package/device.js.map +1 -0
  46. package/encodings.cjs +2 -270
  47. package/encodings.cjs.map +1 -0
  48. package/encodings.js +269 -265
  49. package/encodings.js.map +1 -0
  50. package/errors.cjs +2 -34
  51. package/errors.cjs.map +1 -0
  52. package/errors.d.ts +1 -1
  53. package/errors.d.ts.map +1 -1
  54. package/errors.js +8 -29
  55. package/errors.js.map +1 -0
  56. package/file.cjs +2 -29
  57. package/file.cjs.map +1 -0
  58. package/file.js +19 -23
  59. package/file.js.map +1 -0
  60. package/format/_exports.d.ts +4 -4
  61. package/format/_exports.d.ts.map +1 -1
  62. package/format/index.d.ts +1 -1
  63. package/format/index.d.ts.map +1 -1
  64. package/format/number.d.ts +1 -1
  65. package/format/number.d.ts.map +1 -1
  66. package/format/percent.d.ts +2 -2
  67. package/format/percent.d.ts.map +1 -1
  68. package/format.cjs +2 -0
  69. package/format.cjs.map +1 -0
  70. package/format.js +27 -0
  71. package/format.js.map +1 -0
  72. package/html.cjs +2 -202
  73. package/html.cjs.map +1 -0
  74. package/html.d.ts +2 -2
  75. package/html.d.ts.map +1 -1
  76. package/html.js +120 -177
  77. package/html.js.map +1 -0
  78. package/id.cjs +3 -76
  79. package/id.cjs.map +1 -0
  80. package/id.js +15 -70
  81. package/id.js.map +1 -0
  82. package/imports.cjs +2 -45
  83. package/imports.cjs.map +1 -0
  84. package/imports.js +22 -37
  85. package/imports.js.map +1 -0
  86. package/math.cjs +2 -23
  87. package/math.cjs.map +1 -0
  88. package/math.d.ts +1 -1
  89. package/math.d.ts.map +1 -1
  90. package/math.js +10 -14
  91. package/math.js.map +1 -0
  92. package/media.cjs +2 -115
  93. package/media.cjs.map +1 -0
  94. package/media.js +54 -96
  95. package/media.js.map +1 -0
  96. package/mobx/apply-observable.d.ts +1 -1
  97. package/mobx/apply-observable.d.ts.map +1 -1
  98. package/mobx/create-enhanced-atom.d.ts +2 -2
  99. package/mobx/create-enhanced-atom.d.ts.map +1 -1
  100. package/mobx/deep-observable-struct.d.ts +1 -1
  101. package/mobx/deep-observable-struct.d.ts.map +1 -1
  102. package/mobx/get-mobx-administration.d.ts +2 -2
  103. package/mobx/get-mobx-administration.d.ts.map +1 -1
  104. package/mobx/index.d.ts +5 -5
  105. package/mobx/index.d.ts.map +1 -1
  106. package/mobx.cjs +2 -0
  107. package/mobx.cjs.map +1 -0
  108. package/mobx.js +89 -0
  109. package/mobx.js.map +1 -0
  110. package/ms.cjs +2 -22
  111. package/ms.cjs.map +1 -0
  112. package/ms.js +12 -17
  113. package/ms.js.map +1 -0
  114. package/number.cjs +2 -16
  115. package/number.cjs.map +1 -0
  116. package/number.js +9 -12
  117. package/number.js.map +1 -0
  118. package/package.json +101 -70
  119. package/parser/_exports.d.ts +3 -3
  120. package/parser/_exports.d.ts.map +1 -1
  121. package/parser/index.d.ts +1 -1
  122. package/parser/index.d.ts.map +1 -1
  123. package/parser/number.d.ts +1 -1
  124. package/parser/number.d.ts.map +1 -1
  125. package/parser/percent.d.ts +2 -2
  126. package/parser/percent.d.ts.map +1 -1
  127. package/parser/string.d.ts +1 -1
  128. package/parser/string.d.ts.map +1 -1
  129. package/parser.cjs +2 -0
  130. package/parser.cjs.map +1 -0
  131. package/parser.js +15 -0
  132. package/parser.js.map +1 -0
  133. package/price.cjs +2 -21
  134. package/price.cjs.map +1 -0
  135. package/price.js +13 -16
  136. package/price.js.map +1 -0
  137. package/random.cjs +2 -25
  138. package/random.cjs.map +1 -0
  139. package/random.js +11 -13
  140. package/random.js.map +1 -0
  141. package/react/hooks/index.d.ts +21 -21
  142. package/react/hooks/index.d.ts.map +1 -1
  143. package/react/hooks/use-click-outside.d.ts +1 -1
  144. package/react/hooks/use-define-ref.d.ts +1 -1
  145. package/react/hooks/use-element-ref.d.ts +1 -1
  146. package/react/hooks/use-event.d.ts +1 -1
  147. package/react/hooks/use-event.d.ts.map +1 -1
  148. package/react/hooks/use-initial-height.d.ts +1 -1
  149. package/react/hooks/use-last-value-ref.d.ts +1 -1
  150. package/react/hooks/use-resize-observer.d.ts +1 -1
  151. package/react/hooks/use-sync-ref.d.ts +1 -1
  152. package/react/hooks/use-toggle.d.ts +1 -1
  153. package/react/hooks/use-value.d.ts +1 -1
  154. package/react/index.d.ts +1 -1
  155. package/react/index.d.ts.map +1 -1
  156. package/react.cjs +2 -0
  157. package/react.cjs.map +1 -0
  158. package/react.js +152 -0
  159. package/react.js.map +1 -0
  160. package/sound.cjs +2 -16
  161. package/sound.cjs.map +1 -0
  162. package/sound.js +7 -11
  163. package/sound.js.map +1 -0
  164. package/text.cjs +2 -53
  165. package/text.cjs.map +1 -0
  166. package/text.js +20 -46
  167. package/text.js.map +1 -0
  168. package/type-guard/_exports.d.ts +1 -1
  169. package/type-guard/_exports.d.ts.map +1 -1
  170. package/type-guard/index.d.ts +1 -1
  171. package/type-guard/index.d.ts.map +1 -1
  172. package/type-guard.cjs +2 -0
  173. package/type-guard.cjs.map +1 -0
  174. package/type-guard.js +5 -0
  175. package/type-guard.js.map +1 -0
  176. package/utility-types.cjs +2 -0
  177. package/utility-types.cjs.map +1 -0
  178. package/utility-types.d.ts.map +1 -0
  179. package/utility-types.js +2 -0
  180. package/utility-types.js.map +1 -0
  181. package/utils/types.cjs +1 -1
  182. package/utils/types.cjs.map +1 -0
  183. package/utils/types.js +2 -1
  184. package/utils/types.js.map +1 -0
  185. package/vibrate.cjs +2 -12
  186. package/vibrate.cjs.map +1 -0
  187. package/vibrate.js +6 -7
  188. package/vibrate.js.map +1 -0
  189. package/~index-C3wKHvHr.js +80 -0
  190. package/~index-C3wKHvHr.js.map +1 -0
  191. package/~index-PKNbSTT-.js +2 -0
  192. package/~index-PKNbSTT-.js.map +1 -0
  193. package/~number-B1MpW9GU.js +2 -0
  194. package/~number-B1MpW9GU.js.map +1 -0
  195. package/~number-DX076ykA.js +2 -0
  196. package/~number-DX076ykA.js.map +1 -0
  197. package/~number-EWff2XI6.js +25 -0
  198. package/~number-EWff2XI6.js.map +1 -0
  199. package/~number-baxVnzrJ.js +32 -0
  200. package/~number-baxVnzrJ.js.map +1 -0
  201. package/async.d.cts +0 -28
  202. package/async.d.cts.map +0 -1
  203. package/common.d.cts +0 -15
  204. package/common.d.cts.map +0 -1
  205. package/complex/counter.cjs +0 -21
  206. package/complex/counter.d.cts +0 -15
  207. package/complex/counter.d.cts.map +0 -1
  208. package/complex/counter.js +0 -17
  209. package/complex/global-config.cjs +0 -46
  210. package/complex/global-config.d.cts +0 -11
  211. package/complex/global-config.d.cts.map +0 -1
  212. package/complex/global-config.js +0 -41
  213. package/complex/index.cjs +0 -19
  214. package/complex/index.d.cts +0 -4
  215. package/complex/index.d.cts.map +0 -1
  216. package/complex/index.js +0 -3
  217. package/complex/modules-factory.cjs +0 -50
  218. package/complex/modules-factory.d.cts +0 -49
  219. package/complex/modules-factory.d.cts.map +0 -1
  220. package/complex/modules-factory.js +0 -46
  221. package/cookie.d.cts +0 -3
  222. package/cookie.d.cts.map +0 -1
  223. package/css.d.cts +0 -42
  224. package/css.d.cts.map +0 -1
  225. package/data.d.cts +0 -4
  226. package/data.d.cts.map +0 -1
  227. package/date-time.d.cts +0 -28
  228. package/date-time.d.cts.map +0 -1
  229. package/device.d.cts +0 -8
  230. package/device.d.cts.map +0 -1
  231. package/encodings.d.cts +0 -2
  232. package/encodings.d.cts.map +0 -1
  233. package/errors.d.cts +0 -19
  234. package/errors.d.cts.map +0 -1
  235. package/file.d.cts +0 -3
  236. package/file.d.cts.map +0 -1
  237. package/format/_exports.cjs +0 -20
  238. package/format/_exports.d.cts +0 -5
  239. package/format/_exports.d.cts.map +0 -1
  240. package/format/_exports.js +0 -4
  241. package/format/constants.cjs +0 -6
  242. package/format/constants.d.cts +0 -4
  243. package/format/constants.d.cts.map +0 -1
  244. package/format/constants.js +0 -3
  245. package/format/index.cjs +0 -40
  246. package/format/index.d.cts +0 -3
  247. package/format/index.d.cts.map +0 -1
  248. package/format/index.js +0 -4
  249. package/format/number.cjs +0 -48
  250. package/format/number.d.cts +0 -36
  251. package/format/number.d.cts.map +0 -1
  252. package/format/number.js +0 -44
  253. package/format/percent.cjs +0 -27
  254. package/format/percent.d.cts +0 -15
  255. package/format/percent.d.cts.map +0 -1
  256. package/format/percent.js +0 -23
  257. package/format/skip-spaces.cjs +0 -8
  258. package/format/skip-spaces.d.cts +0 -5
  259. package/format/skip-spaces.d.cts.map +0 -1
  260. package/format/skip-spaces.js +0 -4
  261. package/html.d.cts +0 -44
  262. package/html.d.cts.map +0 -1
  263. package/id.d.cts +0 -63
  264. package/id.d.cts.map +0 -1
  265. package/imports.d.cts +0 -15
  266. package/imports.d.cts.map +0 -1
  267. package/math.d.cts +0 -13
  268. package/math.d.cts.map +0 -1
  269. package/media.d.cts +0 -20
  270. package/media.d.cts.map +0 -1
  271. package/mobx/apply-observable.cjs +0 -16
  272. package/mobx/apply-observable.d.cts +0 -4
  273. package/mobx/apply-observable.d.cts.map +0 -1
  274. package/mobx/apply-observable.js +0 -12
  275. package/mobx/create-enhanced-atom.cjs +0 -16
  276. package/mobx/create-enhanced-atom.d.cts +0 -11
  277. package/mobx/create-enhanced-atom.d.cts.map +0 -1
  278. package/mobx/create-enhanced-atom.js +0 -12
  279. package/mobx/deep-observable-struct.cjs +0 -61
  280. package/mobx/deep-observable-struct.d.cts +0 -7
  281. package/mobx/deep-observable-struct.d.cts.map +0 -1
  282. package/mobx/deep-observable-struct.js +0 -57
  283. package/mobx/get-mobx-administration.cjs +0 -6
  284. package/mobx/get-mobx-administration.d.cts +0 -6
  285. package/mobx/get-mobx-administration.d.cts.map +0 -1
  286. package/mobx/get-mobx-administration.js +0 -2
  287. package/mobx/index.cjs +0 -21
  288. package/mobx/index.d.cts +0 -6
  289. package/mobx/index.d.cts.map +0 -1
  290. package/mobx/index.js +0 -5
  291. package/mobx/lazy-observe.cjs +0 -66
  292. package/mobx/lazy-observe.d.cts +0 -14
  293. package/mobx/lazy-observe.d.cts.map +0 -1
  294. package/mobx/lazy-observe.js +0 -62
  295. package/ms.d.cts +0 -19
  296. package/ms.d.cts.map +0 -1
  297. package/number.d.cts +0 -8
  298. package/number.d.cts.map +0 -1
  299. package/parser/_exports.cjs +0 -19
  300. package/parser/_exports.d.cts +0 -4
  301. package/parser/_exports.d.cts.map +0 -1
  302. package/parser/_exports.js +0 -3
  303. package/parser/index.cjs +0 -40
  304. package/parser/index.d.cts +0 -3
  305. package/parser/index.d.cts.map +0 -1
  306. package/parser/index.js +0 -4
  307. package/parser/number.cjs +0 -48
  308. package/parser/number.d.cts +0 -21
  309. package/parser/number.d.cts.map +0 -1
  310. package/parser/number.js +0 -44
  311. package/parser/percent.cjs +0 -8
  312. package/parser/percent.d.cts +0 -4
  313. package/parser/percent.d.cts.map +0 -1
  314. package/parser/percent.js +0 -4
  315. package/parser/string.cjs +0 -18
  316. package/parser/string.d.cts +0 -7
  317. package/parser/string.d.cts.map +0 -1
  318. package/parser/string.js +0 -14
  319. package/price.d.cts +0 -6
  320. package/price.d.cts.map +0 -1
  321. package/random.d.cts +0 -9
  322. package/random.d.cts.map +0 -1
  323. package/react/hooks/index.cjs +0 -37
  324. package/react/hooks/index.d.cts +0 -22
  325. package/react/hooks/index.d.cts.map +0 -1
  326. package/react/hooks/index.js +0 -21
  327. package/react/hooks/use-abort-controller.cjs +0 -15
  328. package/react/hooks/use-abort-controller.d.cts +0 -2
  329. package/react/hooks/use-abort-controller.d.cts.map +0 -1
  330. package/react/hooks/use-abort-controller.js +0 -11
  331. package/react/hooks/use-abort-signal.cjs +0 -8
  332. package/react/hooks/use-abort-signal.d.cts +0 -2
  333. package/react/hooks/use-abort-signal.d.cts.map +0 -1
  334. package/react/hooks/use-abort-signal.js +0 -4
  335. package/react/hooks/use-click-outside.cjs +0 -17
  336. package/react/hooks/use-click-outside.d.cts +0 -9
  337. package/react/hooks/use-click-outside.d.cts.map +0 -1
  338. package/react/hooks/use-click-outside.js +0 -13
  339. package/react/hooks/use-constant.cjs +0 -19
  340. package/react/hooks/use-constant.d.cts +0 -9
  341. package/react/hooks/use-constant.d.cts.map +0 -1
  342. package/react/hooks/use-constant.js +0 -15
  343. package/react/hooks/use-define-ref.cjs +0 -19
  344. package/react/hooks/use-define-ref.d.cts +0 -10
  345. package/react/hooks/use-define-ref.d.cts.map +0 -1
  346. package/react/hooks/use-define-ref.js +0 -15
  347. package/react/hooks/use-element-ref.cjs +0 -12
  348. package/react/hooks/use-element-ref.d.cts +0 -2
  349. package/react/hooks/use-element-ref.d.cts.map +0 -1
  350. package/react/hooks/use-element-ref.js +0 -8
  351. package/react/hooks/use-event-listener.cjs +0 -17
  352. package/react/hooks/use-event-listener.d.cts +0 -8
  353. package/react/hooks/use-event-listener.d.cts.map +0 -1
  354. package/react/hooks/use-event-listener.js +0 -13
  355. package/react/hooks/use-event.cjs +0 -23
  356. package/react/hooks/use-event.d.cts +0 -3
  357. package/react/hooks/use-event.d.cts.map +0 -1
  358. package/react/hooks/use-event.js +0 -19
  359. package/react/hooks/use-flag.cjs +0 -19
  360. package/react/hooks/use-flag.d.cts +0 -8
  361. package/react/hooks/use-flag.d.cts.map +0 -1
  362. package/react/hooks/use-flag.js +0 -15
  363. package/react/hooks/use-force-update.cjs +0 -11
  364. package/react/hooks/use-force-update.d.cts +0 -2
  365. package/react/hooks/use-force-update.d.cts.map +0 -1
  366. package/react/hooks/use-force-update.js +0 -7
  367. package/react/hooks/use-initial-height.cjs +0 -15
  368. package/react/hooks/use-initial-height.d.cts +0 -5
  369. package/react/hooks/use-initial-height.d.cts.map +0 -1
  370. package/react/hooks/use-initial-height.js +0 -11
  371. package/react/hooks/use-instance.cjs +0 -31
  372. package/react/hooks/use-instance.d.cts +0 -27
  373. package/react/hooks/use-instance.d.cts.map +0 -1
  374. package/react/hooks/use-instance.js +0 -27
  375. package/react/hooks/use-intersection-observer.cjs +0 -14
  376. package/react/hooks/use-intersection-observer.d.cts +0 -2
  377. package/react/hooks/use-intersection-observer.d.cts.map +0 -1
  378. package/react/hooks/use-intersection-observer.js +0 -10
  379. package/react/hooks/use-last-defined-value.cjs +0 -12
  380. package/react/hooks/use-last-defined-value.d.cts +0 -2
  381. package/react/hooks/use-last-defined-value.d.cts.map +0 -1
  382. package/react/hooks/use-last-defined-value.js +0 -8
  383. package/react/hooks/use-last-value-ref.cjs +0 -12
  384. package/react/hooks/use-last-value-ref.d.cts +0 -2
  385. package/react/hooks/use-last-value-ref.d.cts.map +0 -1
  386. package/react/hooks/use-last-value-ref.js +0 -8
  387. package/react/hooks/use-life-cycle.cjs +0 -14
  388. package/react/hooks/use-life-cycle.d.cts +0 -5
  389. package/react/hooks/use-life-cycle.d.cts.map +0 -1
  390. package/react/hooks/use-life-cycle.js +0 -10
  391. package/react/hooks/use-resize-observer.cjs +0 -15
  392. package/react/hooks/use-resize-observer.d.cts +0 -2
  393. package/react/hooks/use-resize-observer.d.cts.map +0 -1
  394. package/react/hooks/use-resize-observer.js +0 -11
  395. package/react/hooks/use-sync-ref.cjs +0 -10
  396. package/react/hooks/use-sync-ref.d.cts +0 -2
  397. package/react/hooks/use-sync-ref.d.cts.map +0 -1
  398. package/react/hooks/use-sync-ref.js +0 -6
  399. package/react/hooks/use-toggle.cjs +0 -10
  400. package/react/hooks/use-toggle.d.cts +0 -2
  401. package/react/hooks/use-toggle.d.cts.map +0 -1
  402. package/react/hooks/use-toggle.js +0 -6
  403. package/react/hooks/use-value.cjs +0 -12
  404. package/react/hooks/use-value.d.cts +0 -5
  405. package/react/hooks/use-value.d.cts.map +0 -1
  406. package/react/hooks/use-value.js +0 -8
  407. package/react/hooks/use-visibility-state.cjs +0 -18
  408. package/react/hooks/use-visibility-state.d.cts +0 -2
  409. package/react/hooks/use-visibility-state.d.cts.map +0 -1
  410. package/react/hooks/use-visibility-state.js +0 -14
  411. package/react/index.cjs +0 -17
  412. package/react/index.d.cts +0 -2
  413. package/react/index.d.cts.map +0 -1
  414. package/react/index.js +0 -1
  415. package/sound.d.cts +0 -7
  416. package/sound.d.cts.map +0 -1
  417. package/storage.cjs +0 -48
  418. package/storage.d.cts +0 -39
  419. package/storage.d.cts.map +0 -1
  420. package/storage.js +0 -43
  421. package/text.d.cts +0 -15
  422. package/text.d.cts.map +0 -1
  423. package/type-guard/_exports.cjs +0 -129
  424. package/type-guard/_exports.d.cts +0 -86
  425. package/type-guard/_exports.d.cts.map +0 -1
  426. package/type-guard/_exports.js +0 -125
  427. package/type-guard/index.cjs +0 -40
  428. package/type-guard/index.d.cts +0 -3
  429. package/type-guard/index.d.cts.map +0 -1
  430. package/type-guard/index.js +0 -4
  431. package/utils/types.d.cts +0 -395
  432. package/utils/types.d.cts.map +0 -1
  433. package/vibrate.d.cts +0 -5
  434. package/vibrate.d.cts.map +0 -1
package/ms.cjs CHANGED
@@ -1,22 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ms = exports.unitsToMs = void 0;
4
- exports.unitsToMs = {
5
- ms: 1,
6
- sec: 1000,
7
- min: 1000 * 60,
8
- hour: 1000 * 60 * 60,
9
- day: 1000 * 60 * 60 * 24,
10
- week: 1000 * 60 * 60 * 24 * 7,
11
- };
12
- /**
13
- * Переводит значение в юнитах в миллисекунды
14
- *
15
- * @example
16
- * ```ts
17
- * ms(1, 'min') // 60_000
18
- * ms(30, 'sec') // 30_000
19
- * ```
20
- */
21
- const ms = (value, unit = 'ms') => value * exports.unitsToMs[unit];
22
- exports.ms = ms;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={ms:1,sec:1e3,min:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},o=(s,t="ms")=>s*e[t];exports.ms=o;exports.unitsToMs=e;
2
+ //# sourceMappingURL=ms.cjs.map
package/ms.cjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ms.cjs","sources":["../src/ms.ts"],"sourcesContent":["export const unitsToMs = {\n ms: 1,\n sec: 1000,\n min: 1000 * 60,\n hour: 1000 * 60 * 60,\n day: 1000 * 60 * 60 * 24,\n week: 1000 * 60 * 60 * 24 * 7,\n} as const;\n\n/**\n * Переводит значение в юнитах в миллисекунды\n *\n * @example\n * ```ts\n * ms(1, 'min') // 60_000\n * ms(30, 'sec') // 30_000\n * ```\n */\nexport const ms = (value: number, unit: keyof typeof unitsToMs = 'ms') =>\n value * unitsToMs[unit];\n"],"names":["unitsToMs","ms","value","unit"],"mappings":"gFAAO,MAAMA,EAAY,CACvB,GAAI,EACJ,IAAK,IACL,IAAK,IAAO,GACZ,KAAM,IAAO,GAAK,GAClB,IAAK,IAAO,GAAK,GAAK,GACtB,KAAM,IAAO,GAAK,GAAK,GAAK,CAC9B,EAWaC,EAAK,CAACC,EAAeC,EAA+B,OAC/DD,EAAQF,EAAUG,CAAI"}
package/ms.js CHANGED
@@ -1,18 +1,13 @@
1
- export const unitsToMs = {
2
- ms: 1,
3
- sec: 1000,
4
- min: 1000 * 60,
5
- hour: 1000 * 60 * 60,
6
- day: 1000 * 60 * 60 * 24,
7
- week: 1000 * 60 * 60 * 24 * 7,
1
+ const o = {
2
+ ms: 1,
3
+ sec: 1e3,
4
+ min: 6e4,
5
+ hour: 36e5,
6
+ day: 864e5,
7
+ week: 6048e5
8
+ }, m = (e, s = "ms") => e * o[s];
9
+ export {
10
+ m as ms,
11
+ o as unitsToMs
8
12
  };
9
- /**
10
- * Переводит значение в юнитах в миллисекунды
11
- *
12
- * @example
13
- * ```ts
14
- * ms(1, 'min') // 60_000
15
- * ms(30, 'sec') // 30_000
16
- * ```
17
- */
18
- export const ms = (value, unit = 'ms') => value * unitsToMs[unit];
13
+ //# sourceMappingURL=ms.js.map
package/ms.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ms.js","sources":["../src/ms.ts"],"sourcesContent":["export const unitsToMs = {\n ms: 1,\n sec: 1000,\n min: 1000 * 60,\n hour: 1000 * 60 * 60,\n day: 1000 * 60 * 60 * 24,\n week: 1000 * 60 * 60 * 24 * 7,\n} as const;\n\n/**\n * Переводит значение в юнитах в миллисекунды\n *\n * @example\n * ```ts\n * ms(1, 'min') // 60_000\n * ms(30, 'sec') // 30_000\n * ```\n */\nexport const ms = (value: number, unit: keyof typeof unitsToMs = 'ms') =>\n value * unitsToMs[unit];\n"],"names":["unitsToMs","ms","value","unit"],"mappings":"AAAO,MAAMA,IAAY;AAAA,EACvB,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,GAWaC,IAAK,CAACC,GAAeC,IAA+B,SAC/DD,IAAQF,EAAUG,CAAI;"}
package/number.cjs CHANGED
@@ -1,16 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.round = round;
4
- /**
5
- * Works like `parseFloat(number.toFixed(4))` but performance better
6
- *
7
- * @example
8
- * round(191.212999999999999999999999, 4) // 191.213
9
- */
10
- function round(value, decimalPlaces = 0) {
11
- if (!decimalPlaces) {
12
- return Math.round(value);
13
- }
14
- const factor = 10 ** decimalPlaces;
15
- return Math.round(value * factor) / factor;
16
- }
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(r,t=0){if(!t)return Math.round(r);const n=10**t;return Math.round(r*n)/n}exports.round=o;
2
+ //# sourceMappingURL=number.cjs.map
package/number.cjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.cjs","sources":["../src/number.ts"],"sourcesContent":["/**\n * Works like `parseFloat(number.toFixed(4))` but performance better\n *\n * @example\n * round(191.212999999999999999999999, 4) // 191.213\n */\nexport function round(value: number, decimalPlaces: number = 0): number {\n if (!decimalPlaces) {\n return Math.round(value);\n }\n\n const factor = 10 ** decimalPlaces;\n return Math.round(value * factor) / factor;\n}\n"],"names":["round","value","decimalPlaces","factor"],"mappings":"gFAMO,SAASA,EAAMC,EAAeC,EAAwB,EAAW,CACtE,GAAI,CAACA,EACH,OAAO,KAAK,MAAMD,CAAK,EAGzB,MAAME,EAAS,IAAMD,EACrB,OAAO,KAAK,MAAMD,EAAQE,CAAM,EAAIA,CACtC"}
package/number.js CHANGED
@@ -1,13 +1,10 @@
1
- /**
2
- * Works like `parseFloat(number.toFixed(4))` but performance better
3
- *
4
- * @example
5
- * round(191.212999999999999999999999, 4) // 191.213
6
- */
7
- export function round(value, decimalPlaces = 0) {
8
- if (!decimalPlaces) {
9
- return Math.round(value);
10
- }
11
- const factor = 10 ** decimalPlaces;
12
- return Math.round(value * factor) / factor;
1
+ function o(r, n = 0) {
2
+ if (!n)
3
+ return Math.round(r);
4
+ const t = 10 ** n;
5
+ return Math.round(r * t) / t;
13
6
  }
7
+ export {
8
+ o as round
9
+ };
10
+ //# sourceMappingURL=number.js.map
package/number.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number.js","sources":["../src/number.ts"],"sourcesContent":["/**\n * Works like `parseFloat(number.toFixed(4))` but performance better\n *\n * @example\n * round(191.212999999999999999999999, 4) // 191.213\n */\nexport function round(value: number, decimalPlaces: number = 0): number {\n if (!decimalPlaces) {\n return Math.round(value);\n }\n\n const factor = 10 ** decimalPlaces;\n return Math.round(value * factor) / factor;\n}\n"],"names":["round","value","decimalPlaces","factor"],"mappings":"AAMO,SAASA,EAAMC,GAAeC,IAAwB,GAAW;AACtE,MAAI,CAACA;AACH,WAAO,KAAK,MAAMD,CAAK;AAGzB,QAAME,IAAS,MAAMD;AACrB,SAAO,KAAK,MAAMD,IAAQE,CAAM,IAAIA;AACtC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yummies",
3
- "version": "5.7.1",
3
+ "version": "5.9.0",
4
4
  "keywords": [
5
5
  "javascript",
6
6
  "typescript",
@@ -47,174 +47,205 @@
47
47
  "@vitest/coverage-istanbul": "^3.1.2",
48
48
  "commitfmt": "^1.0.4",
49
49
  "js2me-biome-config": "^1.0.3",
50
- "sborshik": "^1.0.10",
51
50
  "jsdom": "^26.1.0",
52
51
  "lefthook": "^1.11.16",
53
52
  "nodemon": "^3.1.9",
54
53
  "rimraf": "^6.0.1",
54
+ "sborshik": "^1.0.22",
55
55
  "tsx": "^4.20.5",
56
56
  "typescript": "^5.8.3",
57
+ "vite": "^7.1.9",
58
+ "vite-plugin-dts": "^4.5.4",
57
59
  "vitest": "^3.1.2",
58
60
  "zshy": "^0.4.2"
59
61
  },
60
62
  "type": "module",
61
- "files": [
62
- "*"
63
- ],
64
63
  "exports": {
65
- "./package.json": "./package.json",
66
- "./complex": {
67
- "types": "./complex/index.d.cts",
68
- "import": "./complex/index.js",
69
- "require": "./complex/index.cjs"
70
- },
71
- "./format": {
72
- "types": "./format/index.d.cts",
73
- "import": "./format/index.js",
74
- "require": "./format/index.cjs"
75
- },
76
- "./mobx": {
77
- "types": "./mobx/index.d.cts",
78
- "import": "./mobx/index.js",
79
- "require": "./mobx/index.cjs"
80
- },
81
- "./parser": {
82
- "types": "./parser/index.d.cts",
83
- "import": "./parser/index.js",
84
- "require": "./parser/index.cjs"
85
- },
86
- "./react": {
87
- "types": "./react/index.d.cts",
88
- "import": "./react/index.js",
89
- "require": "./react/index.cjs"
90
- },
91
- "./type-guard": {
92
- "types": "./type-guard/index.d.cts",
93
- "import": "./type-guard/index.js",
94
- "require": "./type-guard/index.cjs"
95
- },
96
- "./utils/types": {
97
- "types": "./utils/types.d.cts",
98
- "import": "./utils/types.js",
99
- "require": "./utils/types.cjs"
100
- },
101
64
  "./async": {
102
- "types": "./async.d.cts",
103
65
  "import": "./async.js",
66
+ "default": "./async.js",
67
+ "types": "./async.d.ts",
104
68
  "require": "./async.cjs"
105
69
  },
106
70
  "./common": {
107
- "types": "./common.d.cts",
108
71
  "import": "./common.js",
72
+ "default": "./common.js",
73
+ "types": "./common.d.ts",
109
74
  "require": "./common.cjs"
110
75
  },
76
+ "./complex": {
77
+ "import": "./complex.js",
78
+ "default": "./complex.js",
79
+ "types": "./complex/index.d.ts",
80
+ "require": "./complex.cjs"
81
+ },
111
82
  "./cookie": {
112
- "types": "./cookie.d.cts",
113
83
  "import": "./cookie.js",
84
+ "default": "./cookie.js",
85
+ "types": "./cookie.d.ts",
114
86
  "require": "./cookie.cjs"
115
87
  },
116
88
  "./css": {
117
- "types": "./css.d.cts",
118
89
  "import": "./css.js",
90
+ "default": "./css.js",
91
+ "types": "./css.d.ts",
119
92
  "require": "./css.cjs"
120
93
  },
121
94
  "./data": {
122
- "types": "./data.d.cts",
123
95
  "import": "./data.js",
96
+ "default": "./data.js",
97
+ "types": "./data.d.ts",
124
98
  "require": "./data.cjs"
125
99
  },
126
100
  "./date-time": {
127
- "types": "./date-time.d.cts",
128
101
  "import": "./date-time.js",
102
+ "default": "./date-time.js",
103
+ "types": "./date-time.d.ts",
129
104
  "require": "./date-time.cjs"
130
105
  },
131
106
  "./device": {
132
- "types": "./device.d.cts",
133
107
  "import": "./device.js",
108
+ "default": "./device.js",
109
+ "types": "./device.d.ts",
134
110
  "require": "./device.cjs"
135
111
  },
136
112
  "./encodings": {
137
- "types": "./encodings.d.cts",
138
113
  "import": "./encodings.js",
114
+ "default": "./encodings.js",
115
+ "types": "./encodings.d.ts",
139
116
  "require": "./encodings.cjs"
140
117
  },
141
118
  "./errors": {
142
- "types": "./errors.d.cts",
143
119
  "import": "./errors.js",
120
+ "default": "./errors.js",
121
+ "types": "./errors.d.ts",
144
122
  "require": "./errors.cjs"
145
123
  },
146
124
  "./file": {
147
- "types": "./file.d.cts",
148
125
  "import": "./file.js",
126
+ "default": "./file.js",
127
+ "types": "./file.d.ts",
149
128
  "require": "./file.cjs"
150
129
  },
130
+ "./format": {
131
+ "import": "./format.js",
132
+ "default": "./format.js",
133
+ "types": "./format/index.d.ts",
134
+ "require": "./format.cjs"
135
+ },
151
136
  "./html": {
152
- "types": "./html.d.cts",
153
137
  "import": "./html.js",
138
+ "default": "./html.js",
139
+ "types": "./html.d.ts",
154
140
  "require": "./html.cjs"
155
141
  },
156
142
  "./id": {
157
- "types": "./id.d.cts",
158
143
  "import": "./id.js",
144
+ "default": "./id.js",
145
+ "types": "./id.d.ts",
159
146
  "require": "./id.cjs"
160
147
  },
161
148
  "./imports": {
162
- "types": "./imports.d.cts",
163
149
  "import": "./imports.js",
150
+ "default": "./imports.js",
151
+ "types": "./imports.d.ts",
164
152
  "require": "./imports.cjs"
165
153
  },
166
154
  "./math": {
167
- "types": "./math.d.cts",
168
155
  "import": "./math.js",
156
+ "default": "./math.js",
157
+ "types": "./math.d.ts",
169
158
  "require": "./math.cjs"
170
159
  },
171
160
  "./media": {
172
- "types": "./media.d.cts",
173
161
  "import": "./media.js",
162
+ "default": "./media.js",
163
+ "types": "./media.d.ts",
174
164
  "require": "./media.cjs"
175
165
  },
166
+ "./mobx": {
167
+ "import": "./mobx.js",
168
+ "default": "./mobx.js",
169
+ "types": "./mobx/index.d.ts",
170
+ "require": "./mobx.cjs"
171
+ },
176
172
  "./ms": {
177
- "types": "./ms.d.cts",
178
173
  "import": "./ms.js",
174
+ "default": "./ms.js",
175
+ "types": "./ms.d.ts",
179
176
  "require": "./ms.cjs"
180
177
  },
181
178
  "./number": {
182
- "types": "./number.d.cts",
183
179
  "import": "./number.js",
180
+ "default": "./number.js",
181
+ "types": "./number.d.ts",
184
182
  "require": "./number.cjs"
185
183
  },
184
+ "./parser": {
185
+ "import": "./parser.js",
186
+ "default": "./parser.js",
187
+ "types": "./parser/index.d.ts",
188
+ "require": "./parser.cjs"
189
+ },
186
190
  "./price": {
187
- "types": "./price.d.cts",
188
191
  "import": "./price.js",
192
+ "default": "./price.js",
193
+ "types": "./price.d.ts",
189
194
  "require": "./price.cjs"
190
195
  },
191
196
  "./random": {
192
- "types": "./random.d.cts",
193
197
  "import": "./random.js",
198
+ "default": "./random.js",
199
+ "types": "./random.d.ts",
194
200
  "require": "./random.cjs"
195
201
  },
202
+ "./react": {
203
+ "import": "./react.js",
204
+ "default": "./react.js",
205
+ "types": "./react/index.d.ts",
206
+ "require": "./react.cjs"
207
+ },
196
208
  "./sound": {
197
- "types": "./sound.d.cts",
198
209
  "import": "./sound.js",
210
+ "default": "./sound.js",
211
+ "types": "./sound.d.ts",
199
212
  "require": "./sound.cjs"
200
213
  },
201
- "./storage": {
202
- "types": "./storage.d.cts",
203
- "import": "./storage.js",
204
- "require": "./storage.cjs"
205
- },
206
214
  "./text": {
207
- "types": "./text.d.cts",
208
215
  "import": "./text.js",
216
+ "default": "./text.js",
217
+ "types": "./text.d.ts",
209
218
  "require": "./text.cjs"
210
219
  },
220
+ "./type-guard": {
221
+ "import": "./type-guard.js",
222
+ "default": "./type-guard.js",
223
+ "types": "./type-guard/index.d.ts",
224
+ "require": "./type-guard.cjs"
225
+ },
226
+ "./utility-types": {
227
+ "import": "./utility-types.js",
228
+ "default": "./utility-types.js",
229
+ "types": "./utility-types.d.ts",
230
+ "require": "./utility-types.cjs"
231
+ },
232
+ "./utils/types": {
233
+ "import": "./utils/types.js",
234
+ "default": "./utils/types.js",
235
+ "types": "./utils/types.d.ts",
236
+ "require": "./utils/types.cjs"
237
+ },
211
238
  "./vibrate": {
212
- "types": "./vibrate.d.cts",
213
239
  "import": "./vibrate.js",
240
+ "default": "./vibrate.js",
241
+ "types": "./vibrate.d.ts",
214
242
  "require": "./vibrate.cjs"
215
243
  },
216
- "./utility-types": "./utility-types.d.ts"
244
+ "./package.json": "./package.json"
217
245
  },
246
+ "files": [
247
+ "*"
248
+ ],
218
249
  "scripts": {
219
250
  "clean": "rm -rf dist",
220
251
  "lint:check": "pnpm exec biome check --write --no-errors-on-unmatched --files-ignore-unknown=true",
@@ -222,7 +253,7 @@
222
253
  "check": "npm run lint:check && npm run ts:check",
223
254
  "prebuild": "npm run clean && npm run check",
224
255
  "build:watch": "pnpm build && nodemon --watch src --ext ts --exec \"pnpm build\"",
225
- "build": "sborshik build --fillDist && tsx scripts/generate-utility-types-file",
256
+ "build": "vite build && tsx scripts/prepare-dist && tsx scripts/generate-utility-types-file",
226
257
  "pub": "pnpm build && sborshik publish --useDistDir",
227
258
  "pub:patch": "PUBLISH_VERSION=patch pnpm pub",
228
259
  "pub:minor": "PUBLISH_VERSION=minor pnpm pub",
@@ -1,4 +1,4 @@
1
- export * from "./number.js";
2
- export * from "./percent.js";
3
- export * from "./string.js";
1
+ export * from './number.js';
2
+ export * from './percent.js';
3
+ export * from './string.js';
4
4
  //# sourceMappingURL=_exports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_exports.d.ts","sourceRoot":"","sources":["../../src/parser/_exports.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,6BAA6B;AAC7B,4BAA4B"}
1
+ {"version":3,"file":"_exports.d.ts","sourceRoot":"","sources":["../../src/parser/_exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
package/parser/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import * as parser from "./_exports.js";
1
+ import * as parser from './_exports.js';
2
2
  export { parser };
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,sBAAsB;AAExC,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Maybe } from "../utils/types.js";
1
+ import { Maybe } from '../utils/types.ts';
2
2
  export interface NumberParserSettings<TFallback = number> {
3
3
  digits?: number;
4
4
  fallback?: TFallback;
@@ -1 +1 @@
1
- {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/parser/number.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,0BAA0B;AAE/C,MAAM,WAAW,oBAAoB,CAAC,SAAS,GAAG,MAAM;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,MAAM;KAAI,SAAS,kBACvB,KAAK,CAAC,OAAO,CAAC,iBACN,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,GACpD,MAAM,GAAG,SAAS;;CA+CpB,CAAC"}
1
+ {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/parser/number.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,WAAW,oBAAoB,CAAC,SAAS,GAAG,MAAM;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,MAAM;KAAI,SAAS,kBACvB,KAAK,CAAC,OAAO,CAAC,iBACN,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,GACpD,MAAM,GAAG,SAAS;;CA+CpB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Maybe } from "../utils/types.js";
2
- import { type NumberParserSettings } from "./number.js";
1
+ import { Maybe } from '../utils/types.ts';
2
+ import { NumberParserSettings } from './number.js';
3
3
  export declare const percent: <TFallback = number>(value: Maybe<string | number>, maxValue?: Maybe<string | number>, settings?: Maybe<NumberParserSettings<TFallback>>) => number | TFallback;
4
4
  //# sourceMappingURL=percent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../src/parser/percent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,0BAA0B;AAE/C,OAAO,EAAE,KAAK,oBAAoB,EAAU,oBAAoB;AAEhE,eAAO,MAAM,OAAO,GAAI,SAAS,GAAG,MAAM,EACxC,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC7B,WAAW,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EACjC,WAAW,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,uBAGlD,CAAC"}
1
+ {"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../src/parser/percent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,KAAK,oBAAoB,EAAU,MAAM,aAAa,CAAC;AAEhE,eAAO,MAAM,OAAO,GAAI,SAAS,GAAG,MAAM,EACxC,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC7B,WAAW,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EACjC,WAAW,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,uBAGlD,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Maybe } from "../utils/types.js";
1
+ import { Maybe } from '../utils/types.ts';
2
2
  export interface StringParserSettings<TFallback = string> {
3
3
  fallback?: TFallback;
4
4
  prettyJson?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/parser/string.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,0BAA0B;AAE/C,MAAM,WAAW,oBAAoB,CAAC,SAAS,GAAG,MAAM;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,MAAM,GAAI,SAAS,GAAG,MAAM,EACvC,OAAO,KAAK,CAAC,OAAO,CAAC,EACrB,WAAW,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,KAChD,MAAM,GAAG,SAiBX,CAAC"}
1
+ {"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/parser/string.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,WAAW,oBAAoB,CAAC,SAAS,GAAG,MAAM;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,MAAM,GAAI,SAAS,GAAG,MAAM,EACvC,OAAO,KAAK,CAAC,OAAO,CAAC,EACrB,WAAW,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,KAChD,MAAM,GAAG,SAiBX,CAAC"}
package/parser.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./~number-B1MpW9GU.js"),u=require("yummies/type-guard"),l=(r,e,t)=>n.number(Number(r)/Number(e)*100,t),o=(r,e)=>{const t=e&&"fallback"in e?e.fallback:"";return r==null?t:u.typeGuard.isObject(r)?e?.prettyJson?JSON.stringify(r,null,2):JSON.stringify(r):String(r)},b=Object.freeze(Object.defineProperty({__proto__:null,number:n.number,percent:l,string:o},Symbol.toStringTag,{value:"Module"}));exports.parser=b;
2
+ //# sourceMappingURL=parser.cjs.map
package/parser.cjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.cjs","sources":["../src/parser/percent.ts","../src/parser/string.ts"],"sourcesContent":["import type { Maybe } from 'yummies/utils/types';\n\nimport { type NumberParserSettings, number } from './number.js';\n\nexport const percent = <TFallback = number>(\n value: Maybe<string | number>,\n maxValue?: Maybe<string | number>,\n settings?: Maybe<NumberParserSettings<TFallback>>,\n) => {\n return number<TFallback>((Number(value) / Number(maxValue)) * 100, settings);\n};\n","import { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/utils/types';\n\nexport interface StringParserSettings<TFallback = string> {\n fallback?: TFallback;\n prettyJson?: boolean;\n}\n\nexport const string = <TFallback = string>(\n input: Maybe<unknown>,\n settings?: Maybe<StringParserSettings<TFallback>>,\n): string | TFallback => {\n const fallback =\n settings && 'fallback' in settings ? (settings.fallback as TFallback) : '';\n\n if (input == null) {\n return fallback;\n }\n\n if (typeGuard.isObject(input)) {\n if (settings?.prettyJson) {\n return JSON.stringify(input, null, 2);\n }\n\n return JSON.stringify(input);\n }\n\n return String(input);\n};\n"],"names":["percent","value","maxValue","settings","number","string","input","fallback","typeGuard"],"mappings":"yJAIaA,EAAU,CACrBC,EACAC,EACAC,IAEOC,EAAAA,OAAmB,OAAOH,CAAK,EAAI,OAAOC,CAAQ,EAAK,IAAKC,CAAQ,ECDhEE,EAAS,CACpBC,EACAH,IACuB,CACvB,MAAMI,EACJJ,GAAY,aAAcA,EAAYA,EAAS,SAAyB,GAE1E,OAAIG,GAAS,KACJC,EAGLC,EAAAA,UAAU,SAASF,CAAK,EACtBH,GAAU,WACL,KAAK,UAAUG,EAAO,KAAM,CAAC,EAG/B,KAAK,UAAUA,CAAK,EAGtB,OAAOA,CAAK,CACrB"}
package/parser.js ADDED
@@ -0,0 +1,15 @@
1
+ import { n as o } from "./~number-EWff2XI6.js";
2
+ import { typeGuard as n } from "yummies/type-guard";
3
+ const l = (r, e, t) => o(Number(r) / Number(e) * 100, t), a = (r, e) => {
4
+ const t = e && "fallback" in e ? e.fallback : "";
5
+ return r == null ? t : n.isObject(r) ? e?.prettyJson ? JSON.stringify(r, null, 2) : JSON.stringify(r) : String(r);
6
+ }, b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7
+ __proto__: null,
8
+ number: o,
9
+ percent: l,
10
+ string: a
11
+ }, Symbol.toStringTag, { value: "Module" }));
12
+ export {
13
+ b as parser
14
+ };
15
+ //# sourceMappingURL=parser.js.map
package/parser.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sources":["../src/parser/percent.ts","../src/parser/string.ts"],"sourcesContent":["import type { Maybe } from 'yummies/utils/types';\n\nimport { type NumberParserSettings, number } from './number.js';\n\nexport const percent = <TFallback = number>(\n value: Maybe<string | number>,\n maxValue?: Maybe<string | number>,\n settings?: Maybe<NumberParserSettings<TFallback>>,\n) => {\n return number<TFallback>((Number(value) / Number(maxValue)) * 100, settings);\n};\n","import { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/utils/types';\n\nexport interface StringParserSettings<TFallback = string> {\n fallback?: TFallback;\n prettyJson?: boolean;\n}\n\nexport const string = <TFallback = string>(\n input: Maybe<unknown>,\n settings?: Maybe<StringParserSettings<TFallback>>,\n): string | TFallback => {\n const fallback =\n settings && 'fallback' in settings ? (settings.fallback as TFallback) : '';\n\n if (input == null) {\n return fallback;\n }\n\n if (typeGuard.isObject(input)) {\n if (settings?.prettyJson) {\n return JSON.stringify(input, null, 2);\n }\n\n return JSON.stringify(input);\n }\n\n return String(input);\n};\n"],"names":["percent","value","maxValue","settings","number","string","input","fallback","typeGuard"],"mappings":";;AAIO,MAAMA,IAAU,CACrBC,GACAC,GACAC,MAEOC,EAAmB,OAAOH,CAAK,IAAI,OAAOC,CAAQ,IAAK,KAAKC,CAAQ,GCDhEE,IAAS,CACpBC,GACAH,MACuB;AACvB,QAAMI,IACJJ,KAAY,cAAcA,IAAYA,EAAS,WAAyB;AAE1E,SAAIG,KAAS,OACJC,IAGLC,EAAU,SAASF,CAAK,IACtBH,GAAU,aACL,KAAK,UAAUG,GAAO,MAAM,CAAC,IAG/B,KAAK,UAAUA,CAAK,IAGtB,OAAOA,CAAK;AACrB;;;;;;"}
package/price.cjs CHANGED
@@ -1,21 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatPrice = void 0;
4
- const formatPrice = (price, locale, currency, { withoutSymbol, customSymbol, ...options } = {}) => {
5
- const priceFormatter = new Intl.NumberFormat(locale, {
6
- style: 'currency',
7
- currency,
8
- minimumFractionDigits: 0,
9
- currencyDisplay: 'narrowSymbol',
10
- ...options,
11
- });
12
- const zeroPrice = priceFormatter.format(0);
13
- const currencySymbol = zeroPrice.replace('0', '');
14
- const rawPrice = priceFormatter.format(price);
15
- const priceWithoutCurrency = rawPrice.replace(currencySymbol, '');
16
- if (withoutSymbol) {
17
- return priceWithoutCurrency;
18
- }
19
- return `${priceWithoutCurrency} ${customSymbol ?? (currency === 'RUB' ? 'р' : currencySymbol)}`.replace(/\s{2,}/, ' ');
20
- };
21
- exports.formatPrice = formatPrice;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(o,i,r,{withoutSymbol:n,customSymbol:a,...m}={})=>{const e=new Intl.NumberFormat(i,{style:"currency",currency:r,minimumFractionDigits:0,currencyDisplay:"narrowSymbol",...m}),t=e.format(0).replace("0",""),c=e.format(o).replace(t,"");return n?c:`${c} ${a??(r==="RUB"?"р":t)}`.replace(/\s{2,}/," ")};exports.formatPrice=s;
2
+ //# sourceMappingURL=price.cjs.map
package/price.cjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price.cjs","sources":["../src/price.ts"],"sourcesContent":["export interface PriceFormatOptions\n extends Partial<Omit<Intl.NumberFormatOptions, 'currency'>> {\n withoutSymbol?: boolean;\n customSymbol?: string;\n}\n\nexport const formatPrice = (\n price: number,\n locale: string,\n currency?: string,\n { withoutSymbol, customSymbol, ...options }: PriceFormatOptions = {},\n) => {\n const priceFormatter = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits: 0,\n currencyDisplay: 'narrowSymbol',\n ...options,\n });\n\n const zeroPrice = priceFormatter.format(0);\n const currencySymbol = zeroPrice.replace('0', '');\n const rawPrice = priceFormatter.format(price);\n const priceWithoutCurrency = rawPrice.replace(currencySymbol, '');\n\n if (withoutSymbol) {\n return priceWithoutCurrency;\n }\n\n return `${priceWithoutCurrency} ${\n customSymbol ?? (currency === 'RUB' ? 'р' : currencySymbol)\n }`.replace(/\\s{2,}/, ' ');\n};\n"],"names":["formatPrice","price","locale","currency","withoutSymbol","customSymbol","options","priceFormatter","currencySymbol","priceWithoutCurrency"],"mappings":"gFAMO,MAAMA,EAAc,CACzBC,EACAC,EACAC,EACA,CAAE,cAAAC,EAAe,aAAAC,EAAc,GAAGC,CAAA,EAAgC,KAC/D,CACH,MAAMC,EAAiB,IAAI,KAAK,aAAaL,EAAQ,CACnD,MAAO,WACP,SAAAC,EACA,sBAAuB,EACvB,gBAAiB,eACjB,GAAGG,CAAA,CACJ,EAGKE,EADYD,EAAe,OAAO,CAAC,EACR,QAAQ,IAAK,EAAE,EAE1CE,EADWF,EAAe,OAAON,CAAK,EACN,QAAQO,EAAgB,EAAE,EAEhE,OAAIJ,EACKK,EAGF,GAAGA,CAAoB,IAC5BJ,IAAiBF,IAAa,MAAQ,IAAMK,EAC9C,GAAG,QAAQ,SAAU,GAAG,CAC1B"}
package/price.js CHANGED
@@ -1,17 +1,14 @@
1
- export const formatPrice = (price, locale, currency, { withoutSymbol, customSymbol, ...options } = {}) => {
2
- const priceFormatter = new Intl.NumberFormat(locale, {
3
- style: 'currency',
4
- currency,
5
- minimumFractionDigits: 0,
6
- currencyDisplay: 'narrowSymbol',
7
- ...options,
8
- });
9
- const zeroPrice = priceFormatter.format(0);
10
- const currencySymbol = zeroPrice.replace('0', '');
11
- const rawPrice = priceFormatter.format(price);
12
- const priceWithoutCurrency = rawPrice.replace(currencySymbol, '');
13
- if (withoutSymbol) {
14
- return priceWithoutCurrency;
15
- }
16
- return `${priceWithoutCurrency} ${customSymbol ?? (currency === 'RUB' ? 'р' : currencySymbol)}`.replace(/\s{2,}/, ' ');
1
+ const u = (o, n, r, { withoutSymbol: i, customSymbol: a, ...m } = {}) => {
2
+ const e = new Intl.NumberFormat(n, {
3
+ style: "currency",
4
+ currency: r,
5
+ minimumFractionDigits: 0,
6
+ currencyDisplay: "narrowSymbol",
7
+ ...m
8
+ }), c = e.format(0).replace("0", ""), t = e.format(o).replace(c, "");
9
+ return i ? t : `${t} ${a ?? (r === "RUB" ? "р" : c)}`.replace(/\s{2,}/, " ");
17
10
  };
11
+ export {
12
+ u as formatPrice
13
+ };
14
+ //# sourceMappingURL=price.js.map
package/price.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price.js","sources":["../src/price.ts"],"sourcesContent":["export interface PriceFormatOptions\n extends Partial<Omit<Intl.NumberFormatOptions, 'currency'>> {\n withoutSymbol?: boolean;\n customSymbol?: string;\n}\n\nexport const formatPrice = (\n price: number,\n locale: string,\n currency?: string,\n { withoutSymbol, customSymbol, ...options }: PriceFormatOptions = {},\n) => {\n const priceFormatter = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits: 0,\n currencyDisplay: 'narrowSymbol',\n ...options,\n });\n\n const zeroPrice = priceFormatter.format(0);\n const currencySymbol = zeroPrice.replace('0', '');\n const rawPrice = priceFormatter.format(price);\n const priceWithoutCurrency = rawPrice.replace(currencySymbol, '');\n\n if (withoutSymbol) {\n return priceWithoutCurrency;\n }\n\n return `${priceWithoutCurrency} ${\n customSymbol ?? (currency === 'RUB' ? 'р' : currencySymbol)\n }`.replace(/\\s{2,}/, ' ');\n};\n"],"names":["formatPrice","price","locale","currency","withoutSymbol","customSymbol","options","priceFormatter","currencySymbol","priceWithoutCurrency"],"mappings":"AAMO,MAAMA,IAAc,CACzBC,GACAC,GACAC,GACA,EAAE,eAAAC,GAAe,cAAAC,GAAc,GAAGC,EAAA,IAAgC,OAC/D;AACH,QAAMC,IAAiB,IAAI,KAAK,aAAaL,GAAQ;AAAA,IACnD,OAAO;AAAA,IACP,UAAAC;AAAA,IACA,uBAAuB;AAAA,IACvB,iBAAiB;AAAA,IACjB,GAAGG;AAAA,EAAA,CACJ,GAGKE,IADYD,EAAe,OAAO,CAAC,EACR,QAAQ,KAAK,EAAE,GAE1CE,IADWF,EAAe,OAAON,CAAK,EACN,QAAQO,GAAgB,EAAE;AAEhE,SAAIJ,IACKK,IAGF,GAAGA,CAAoB,IAC5BJ,MAAiBF,MAAa,QAAQ,MAAMK,EAC9C,GAAG,QAAQ,UAAU,GAAG;AAC1B;"}
package/random.cjs CHANGED
@@ -1,25 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getFrequencyValue = exports.getMinorRandomBool = exports.getMajorRandomBool = exports.getRandomBool = exports.getRandomSizeArray = exports.getRandomChoice = exports.getRandomInt = exports.getRandomFloat = void 0;
4
- const getRandomFloat = (min = 0, max = 1) => (Math.random() * (max - min) + min);
5
- exports.getRandomFloat = getRandomFloat;
6
- const getRandomInt = (min = 0, max = 1) => min === max ? min : Math.round((0, exports.getRandomFloat)(min, max));
7
- exports.getRandomInt = getRandomInt;
8
- const getRandomChoice = (arr) => arr[(0, exports.getRandomInt)(0, arr.length - 1)];
9
- exports.getRandomChoice = getRandomChoice;
10
- const getRandomSizeArray = (min = 0, max = 10) => Array.from({ length: (0, exports.getRandomInt)(min, max) }).fill(null);
11
- exports.getRandomSizeArray = getRandomSizeArray;
12
- const getRandomBool = () => (0, exports.getRandomInt)(0, 1) === 1;
13
- exports.getRandomBool = getRandomBool;
14
- const getMajorRandomBool = () => {
15
- return (0, exports.getRandomInt)(0, 10) <= 6;
16
- };
17
- exports.getMajorRandomBool = getMajorRandomBool;
18
- const getMinorRandomBool = () => {
19
- return !(0, exports.getMajorRandomBool)();
20
- };
21
- exports.getMinorRandomBool = getMinorRandomBool;
22
- const getFrequencyValue = (frequency) => {
23
- return Math.random() < frequency;
24
- };
25
- exports.getFrequencyValue = getFrequencyValue;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=(o=0,t=1)=>Math.random()*(t-o)+o,e=(o=0,t=1)=>o===t?o:Math.round(n(o,t)),r=o=>o[e(0,o.length-1)],g=(o=0,t=10)=>Array.from({length:e(o,t)}).fill(null),d=()=>e(0,1)===1,a=()=>e(0,10)<=6,l=()=>!a(),c=o=>Math.random()<o;exports.getFrequencyValue=c;exports.getMajorRandomBool=a;exports.getMinorRandomBool=l;exports.getRandomBool=d;exports.getRandomChoice=r;exports.getRandomFloat=n;exports.getRandomInt=e;exports.getRandomSizeArray=g;
2
+ //# sourceMappingURL=random.cjs.map
package/random.cjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random.cjs","sources":["../src/random.ts"],"sourcesContent":["export const getRandomFloat = <T extends number = number>(\n min = 0,\n max = 1,\n): T => (Math.random() * (max - min) + min) as T;\n\nexport const getRandomInt = <T extends number = number>(min = 0, max = 1): T =>\n min === max ? (min as T) : (Math.round(getRandomFloat(min, max)) as T);\n\nexport const getRandomChoice = <T>(arr: T[]): T =>\n arr[getRandomInt(0, arr.length - 1)];\n\nexport const getRandomSizeArray = (min = 0, max = 10) =>\n Array.from({ length: getRandomInt(min, max) }).fill(null);\n\nexport const getRandomBool = () => getRandomInt(0, 1) === 1;\n\nexport const getMajorRandomBool = () => {\n return getRandomInt(0, 10) <= 6;\n};\n\nexport const getMinorRandomBool = () => {\n return !getMajorRandomBool();\n};\n\nexport const getFrequencyValue = (frequency: number) => {\n return Math.random() < frequency;\n};\n"],"names":["getRandomFloat","min","max","getRandomInt","getRandomChoice","arr","getRandomSizeArray","getRandomBool","getMajorRandomBool","getMinorRandomBool","getFrequencyValue","frequency"],"mappings":"gFAAO,MAAMA,EAAiB,CAC5BC,EAAM,EACNC,EAAM,IACC,KAAK,OAAA,GAAYA,EAAMD,GAAOA,EAE1BE,EAAe,CAA4BF,EAAM,EAAGC,EAAM,IACrED,IAAQC,EAAOD,EAAa,KAAK,MAAMD,EAAeC,EAAKC,CAAG,CAAC,EAEpDE,EAAsBC,GACjCA,EAAIF,EAAa,EAAGE,EAAI,OAAS,CAAC,CAAC,EAExBC,EAAqB,CAACL,EAAM,EAAGC,EAAM,KAChD,MAAM,KAAK,CAAE,OAAQC,EAAaF,EAAKC,CAAG,EAAG,EAAE,KAAK,IAAI,EAE7CK,EAAgB,IAAMJ,EAAa,EAAG,CAAC,IAAM,EAE7CK,EAAqB,IACzBL,EAAa,EAAG,EAAE,GAAK,EAGnBM,EAAqB,IACzB,CAACD,EAAA,EAGGE,EAAqBC,GACzB,KAAK,SAAWA"}