@yelon/util 12.0.17 → 13.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (375) hide show
  1. package/LICENSE +21 -21
  2. package/array/array-type.service.d.ts +68 -68
  3. package/{date-time/yelon-util-date-time.d.ts → array/array.d.ts} +5 -4
  4. package/array/array.service.d.ts +78 -75
  5. package/array/index.d.ts +2 -2
  6. package/array/package.json +6 -7
  7. package/browser/browser.d.ts +5 -4
  8. package/browser/cookie.service.d.ts +67 -64
  9. package/browser/copy.d.ts +6 -6
  10. package/browser/index.d.ts +5 -5
  11. package/browser/is-empty.d.ts +6 -6
  12. package/browser/package.json +5 -6
  13. package/browser/scroll.service.d.ts +37 -34
  14. package/browser/style.d.ts +21 -21
  15. package/config/abc/date-picker.type.d.ts +52 -52
  16. package/config/abc/error-collect.type.d.ts +10 -10
  17. package/config/abc/image.type.d.ts +15 -15
  18. package/config/abc/index.d.ts +16 -16
  19. package/config/abc/loading.type.d.ts +31 -31
  20. package/config/abc/lodop.type.d.ts +33 -33
  21. package/config/abc/media.type.d.ts +11 -11
  22. package/config/abc/onboarding.type.d.ts +4 -4
  23. package/config/abc/page-header.type.d.ts +39 -39
  24. package/config/abc/pdf.type.d.ts +35 -35
  25. package/config/abc/qr.type.d.ts +25 -25
  26. package/config/abc/se.type.d.ts +32 -32
  27. package/config/abc/sg.type.d.ts +10 -10
  28. package/config/abc/st.type.d.ts +427 -427
  29. package/config/abc/sv.type.d.ts +14 -14
  30. package/config/abc/xlsx.type.d.ts +12 -12
  31. package/config/abc/zip.type.d.ts +10 -10
  32. package/config/acl/acl.type.d.ts +32 -32
  33. package/config/auth/auth.type.d.ts +55 -55
  34. package/config/bis/bis.type.d.ts +7 -7
  35. package/config/cache/cache.type.d.ts +40 -40
  36. package/config/chart/chart.type.d.ts +33 -33
  37. package/config/config.d.ts +5 -0
  38. package/config/config.service.d.ts +13 -10
  39. package/config/config.types.d.ts +49 -49
  40. package/config/index.d.ts +14 -14
  41. package/config/mock/mock.type.d.ts +18 -18
  42. package/config/package.json +6 -7
  43. package/config/sf/sf.type.d.ts +127 -127
  44. package/config/stomp/stomp.type.d.ts +2 -2
  45. package/config/theme/http.type.d.ts +14 -14
  46. package/config/theme/i18n.type.d.ts +8 -8
  47. package/config/theme/index.d.ts +3 -3
  48. package/config/theme/responsive.type.d.ts +12 -12
  49. package/config/util/array.type.d.ts +22 -22
  50. package/config/util/currency.type.d.ts +39 -39
  51. package/date-time/date-time.d.ts +5 -0
  52. package/date-time/index.d.ts +2 -2
  53. package/date-time/package.json +6 -7
  54. package/date-time/picker.d.ts +68 -68
  55. package/date-time/time.d.ts +26 -26
  56. package/decorator/convert.d.ts +24 -24
  57. package/decorator/decorator.d.ts +5 -0
  58. package/decorator/index.d.ts +2 -2
  59. package/decorator/package.json +6 -7
  60. package/decorator/zone-outside.d.ts +35 -35
  61. package/{esm2015/array/array-type.service.js → esm2020/array/array-type.service.mjs} +1 -1
  62. package/esm2020/array/array.mjs +5 -0
  63. package/esm2020/array/array.service.mjs +278 -0
  64. package/{esm2015/array/index.js → esm2020/array/index.mjs} +2 -2
  65. package/{esm2015/browser/browser.js → esm2020/browser/browser.mjs} +4 -4
  66. package/esm2020/browser/cookie.service.mjs +103 -0
  67. package/esm2020/browser/copy.mjs +9 -0
  68. package/{esm2015/browser/index.js → esm2020/browser/index.mjs} +5 -5
  69. package/{esm2015/browser/is-empty.js → esm2020/browser/is-empty.mjs} +18 -18
  70. package/esm2020/browser/scroll.service.mjs +88 -0
  71. package/{esm2015/browser/style.js → esm2020/browser/style.mjs} +38 -38
  72. package/{esm2015/config/abc/date-picker.type.js → esm2020/config/abc/date-picker.type.mjs} +1 -1
  73. package/{esm2015/config/abc/error-collect.type.js → esm2020/config/abc/error-collect.type.mjs} +1 -1
  74. package/{esm2015/config/abc/image.type.js → esm2020/config/abc/image.type.mjs} +1 -1
  75. package/{esm2015/config/abc/index.js → esm2020/config/abc/index.mjs} +16 -16
  76. package/{esm2015/config/abc/loading.type.js → esm2020/config/abc/loading.type.mjs} +1 -1
  77. package/{esm2015/config/abc/lodop.type.js → esm2020/config/abc/lodop.type.mjs} +1 -1
  78. package/{esm2015/config/abc/media.type.js → esm2020/config/abc/media.type.mjs} +1 -1
  79. package/{esm2015/config/abc/onboarding.type.js → esm2020/config/abc/onboarding.type.mjs} +1 -1
  80. package/{esm2015/config/abc/page-header.type.js → esm2020/config/abc/page-header.type.mjs} +1 -1
  81. package/esm2020/config/abc/pdf.type.mjs +2 -0
  82. package/esm2020/config/abc/qr.type.mjs +2 -0
  83. package/{esm2015/config/abc/se.type.js → esm2020/config/abc/se.type.mjs} +1 -1
  84. package/{esm2015/config/abc/sg.type.js → esm2020/config/abc/sg.type.mjs} +1 -1
  85. package/{esm2015/config/abc/st.type.js → esm2020/config/abc/st.type.mjs} +1 -1
  86. package/{esm2015/config/abc/sv.type.js → esm2020/config/abc/sv.type.mjs} +2 -2
  87. package/{esm2015/config/abc/xlsx.type.js → esm2020/config/abc/xlsx.type.mjs} +1 -1
  88. package/{esm2015/config/abc/zip.type.js → esm2020/config/abc/zip.type.mjs} +1 -1
  89. package/{esm2015/config/acl/acl.type.js → esm2020/config/acl/acl.type.mjs} +1 -1
  90. package/{esm2015/config/auth/auth.type.js → esm2020/config/auth/auth.type.mjs} +1 -1
  91. package/{esm2015/config/bis/bis.type.js → esm2020/config/bis/bis.type.mjs} +1 -1
  92. package/{esm2015/config/cache/cache.type.js → esm2020/config/cache/cache.type.mjs} +1 -1
  93. package/{esm2015/config/chart/chart.type.js → esm2020/config/chart/chart.type.mjs} +1 -1
  94. package/esm2020/config/config.mjs +5 -0
  95. package/esm2020/config/config.service.mjs +37 -0
  96. package/{esm2015/config/config.types.js → esm2020/config/config.types.mjs} +8 -8
  97. package/{esm2015/config/index.js → esm2020/config/index.mjs} +14 -14
  98. package/{esm2015/config/mock/mock.type.js → esm2020/config/mock/mock.type.mjs} +1 -1
  99. package/{esm2015/config/sf/sf.type.js → esm2020/config/sf/sf.type.mjs} +1 -1
  100. package/{esm2015/config/stomp/stomp.type.js → esm2020/config/stomp/stomp.type.mjs} +1 -1
  101. package/{esm2015/config/theme/http.type.js → esm2020/config/theme/http.type.mjs} +1 -1
  102. package/{esm2015/config/theme/i18n.type.js → esm2020/config/theme/i18n.type.mjs} +1 -1
  103. package/{esm2015/config/theme/index.js → esm2020/config/theme/index.mjs} +3 -3
  104. package/{esm2015/config/theme/responsive.type.js → esm2020/config/theme/responsive.type.mjs} +1 -1
  105. package/{esm2015/config/util/array.type.js → esm2020/config/util/array.type.mjs} +1 -1
  106. package/{esm2015/config/util/currency.type.js → esm2020/config/util/currency.type.mjs} +1 -1
  107. package/esm2020/date-time/date-time.mjs +5 -0
  108. package/{esm2015/date-time/index.js → esm2020/date-time/index.mjs} +2 -2
  109. package/esm2020/date-time/picker.mjs +116 -0
  110. package/{esm2015/date-time/time.js → esm2020/date-time/time.mjs} +88 -84
  111. package/esm2020/decorator/convert.mjs +58 -0
  112. package/esm2020/decorator/decorator.mjs +5 -0
  113. package/{esm2015/decorator/index.js → esm2020/decorator/index.mjs} +2 -2
  114. package/esm2020/decorator/zone-outside.mjs +57 -0
  115. package/esm2020/form/form.mjs +5 -0
  116. package/{esm2015/form/index.js → esm2020/form/index.mjs} +2 -2
  117. package/{esm2015/form/match-control.js → esm2020/form/match-control.mjs} +29 -29
  118. package/{esm2015/form/validators.js → esm2020/form/validators.mjs} +80 -80
  119. package/esm2020/format/currency.service.mjs +238 -0
  120. package/{esm2015/format/currency.types.js → esm2020/format/currency.types.mjs} +7 -7
  121. package/esm2020/format/format.mjs +5 -0
  122. package/{esm2015/format/index.js → esm2020/format/index.mjs} +4 -4
  123. package/esm2020/format/string.mjs +85 -0
  124. package/{esm2015/format/validate.js → esm2020/format/validate.mjs} +93 -93
  125. package/{esm2015/index.js → esm2020/index.mjs} +11 -11
  126. package/{esm2015/math/in-range.js → esm2020/math/in-range.mjs} +24 -24
  127. package/{esm2015/math/index.js → esm2020/math/index.mjs} +2 -2
  128. package/esm2020/math/math.mjs +5 -0
  129. package/{esm2015/math/round.js → esm2020/math/round.mjs} +52 -52
  130. package/{esm2015/other/assert.js → esm2020/other/assert.mjs} +66 -66
  131. package/{esm2015/other/deep.js → esm2020/other/deep.mjs} +75 -75
  132. package/{esm2015/other/index.js → esm2020/other/index.mjs} +7 -5
  133. package/esm2020/other/lazy.service.mjs +119 -0
  134. package/{esm2015/other/logger.js → esm2020/other/logger.mjs} +32 -32
  135. package/esm2020/other/other.mjs +5 -0
  136. package/esm2020/other/resize.mjs +4 -0
  137. package/esm2020/other/url.mjs +13 -0
  138. package/esm2020/pipes/currency/cny.pipe.mjs +23 -0
  139. package/{esm2015/pipes/currency/index.js → esm2020/pipes/currency/index.mjs} +5 -4
  140. package/esm2020/pipes/currency/mega.pipe.mjs +29 -0
  141. package/esm2020/pipes/currency/module.mjs +19 -0
  142. package/esm2020/pipes/currency/pipe-currency.mjs +5 -0
  143. package/esm2020/pipes/currency/price.pipe.mjs +27 -0
  144. package/esm2020/pipes/filter/filter.pipe.mjs +19 -0
  145. package/{esm2015/pipes/filter/index.js → esm2020/pipes/filter/index.mjs} +2 -2
  146. package/esm2020/pipes/filter/module.mjs +17 -0
  147. package/{esm2015/other/yelon-util-other.js → esm2020/pipes/filter/pipe-filter.mjs} +5 -5
  148. package/{esm2015/pipes/format/index.js → esm2020/pipes/format/index.mjs} +2 -2
  149. package/esm2020/pipes/format/mask.pipe.mjs +34 -0
  150. package/esm2020/pipes/format/module.mjs +17 -0
  151. package/{esm2015/array/yelon-util-array.js → esm2020/pipes/format/pipe-format.mjs} +5 -5
  152. package/{esm2015/pipes/index.js → esm2020/pipes/index.mjs} +3 -3
  153. package/esm2020/pipes/pipes.mjs +5 -0
  154. package/{esm2015/token/index.js → esm2020/token/index.mjs} +2 -2
  155. package/{esm2015/token/page-visibility.js → esm2020/token/page-visibility.mjs} +15 -15
  156. package/esm2020/token/token.mjs +5 -0
  157. package/{esm2015/token/window.js → esm2020/token/window.mjs} +16 -16
  158. package/{esm2015/yelon-util.js → esm2020/yelon-util.mjs} +4 -4
  159. package/fesm2015/{yelon-util-array.js → array.mjs} +247 -249
  160. package/fesm2015/array.mjs.map +1 -0
  161. package/fesm2015/{browser.js → browser.mjs} +249 -263
  162. package/fesm2015/browser.mjs.map +1 -0
  163. package/fesm2015/{yelon-util-config.js → config.mjs} +44 -38
  164. package/fesm2015/config.mjs.map +1 -0
  165. package/fesm2015/{yelon-util-date-time.js → date-time.mjs} +197 -197
  166. package/fesm2015/date-time.mjs.map +1 -0
  167. package/fesm2015/{yelon-util-decorator.js → decorator.mjs} +112 -108
  168. package/fesm2015/decorator.mjs.map +1 -0
  169. package/fesm2015/{yelon-util-form.js → form.mjs} +109 -109
  170. package/fesm2015/form.mjs.map +1 -0
  171. package/fesm2015/{yelon-util-format.js → format.mjs} +398 -394
  172. package/fesm2015/format.mjs.map +1 -0
  173. package/fesm2015/{yelon-util-math.js → math.mjs} +76 -76
  174. package/fesm2015/math.mjs.map +1 -0
  175. package/fesm2015/{yelon-util-other.js → other.mjs} +304 -284
  176. package/fesm2015/other.mjs.map +1 -0
  177. package/fesm2015/pipe-currency.mjs +96 -0
  178. package/fesm2015/pipe-currency.mjs.map +1 -0
  179. package/fesm2015/pipe-filter.mjs +40 -0
  180. package/fesm2015/pipe-filter.mjs.map +1 -0
  181. package/fesm2015/pipe-format.mjs +55 -0
  182. package/fesm2015/pipe-format.mjs.map +1 -0
  183. package/fesm2015/{yelon-util-pipes.js → pipes.mjs} +3 -3
  184. package/fesm2015/pipes.mjs.map +1 -0
  185. package/fesm2015/{yelon-util-token.js → token.mjs} +26 -26
  186. package/fesm2015/token.mjs.map +1 -0
  187. package/fesm2015/{yelon-util.js → yelon-util.mjs} +3 -3
  188. package/fesm2015/yelon-util.mjs.map +1 -0
  189. package/fesm2020/array.mjs +285 -0
  190. package/fesm2020/array.mjs.map +1 -0
  191. package/fesm2020/browser.mjs +260 -0
  192. package/fesm2020/browser.mjs.map +1 -0
  193. package/fesm2020/config.mjs +54 -0
  194. package/fesm2020/config.mjs.map +1 -0
  195. package/fesm2020/date-time.mjs +210 -0
  196. package/fesm2020/date-time.mjs.map +1 -0
  197. package/fesm2020/decorator.mjs +121 -0
  198. package/fesm2020/decorator.mjs.map +1 -0
  199. package/fesm2020/form.mjs +118 -0
  200. package/fesm2020/form.mjs.map +1 -0
  201. package/fesm2020/format.mjs +431 -0
  202. package/fesm2020/format.mjs.map +1 -0
  203. package/fesm2020/math.mjs +85 -0
  204. package/fesm2020/math.mjs.map +1 -0
  205. package/fesm2020/other.mjs +318 -0
  206. package/{fesm2015/yelon-util-other.js.map → fesm2020/other.mjs.map} +1 -1
  207. package/fesm2020/pipe-currency.mjs +94 -0
  208. package/fesm2020/pipe-currency.mjs.map +1 -0
  209. package/fesm2020/pipe-filter.mjs +40 -0
  210. package/fesm2020/pipe-filter.mjs.map +1 -0
  211. package/fesm2020/pipe-format.mjs +55 -0
  212. package/fesm2020/pipe-format.mjs.map +1 -0
  213. package/fesm2020/pipes.mjs +8 -0
  214. package/fesm2020/pipes.mjs.map +1 -0
  215. package/fesm2020/token.mjs +38 -0
  216. package/fesm2020/token.mjs.map +1 -0
  217. package/fesm2020/yelon-util.mjs +16 -0
  218. package/fesm2020/yelon-util.mjs.map +1 -0
  219. package/{array/yelon-util-array.d.ts → form/form.d.ts} +5 -4
  220. package/form/index.d.ts +2 -2
  221. package/form/match-control.d.ts +15 -15
  222. package/form/package.json +6 -7
  223. package/form/validators.d.ts +62 -62
  224. package/format/currency.service.d.ts +37 -34
  225. package/format/currency.types.d.ts +77 -77
  226. package/format/format.d.ts +5 -0
  227. package/format/index.d.ts +4 -4
  228. package/format/package.json +6 -7
  229. package/format/string.d.ts +44 -44
  230. package/format/validate.d.ts +72 -72
  231. package/index.d.ts +11 -11
  232. package/math/in-range.d.ts +14 -14
  233. package/math/index.d.ts +2 -2
  234. package/{config/yelon-util-config.d.ts → math/math.d.ts} +5 -4
  235. package/math/package.json +6 -7
  236. package/math/round.d.ts +33 -33
  237. package/other/assert.d.ts +36 -36
  238. package/other/deep.d.ts +33 -33
  239. package/other/index.d.ts +6 -4
  240. package/other/lazy.service.d.ts +25 -22
  241. package/other/logger.d.ts +5 -5
  242. package/{decorator/yelon-util-decorator.d.ts → other/other.d.ts} +5 -4
  243. package/other/package.json +6 -7
  244. package/other/resize.d.ts +1 -0
  245. package/other/url.d.ts +2 -0
  246. package/package.json +132 -8
  247. package/pipes/currency/cny.pipe.d.ts +15 -12
  248. package/pipes/currency/index.d.ts +4 -3
  249. package/pipes/currency/mega.pipe.d.ts +16 -13
  250. package/pipes/currency/module.d.ts +9 -2
  251. package/pipes/currency/package.json +6 -7
  252. package/pipes/currency/pipe-currency.d.ts +5 -0
  253. package/pipes/currency/price.pipe.d.ts +19 -16
  254. package/pipes/filter/filter.pipe.d.ts +13 -10
  255. package/pipes/filter/index.d.ts +2 -2
  256. package/pipes/filter/module.d.ts +7 -2
  257. package/pipes/filter/package.json +6 -7
  258. package/pipes/filter/pipe-filter.d.ts +5 -0
  259. package/pipes/format/index.d.ts +2 -2
  260. package/pipes/format/mask.pipe.d.ts +27 -24
  261. package/pipes/format/module.d.ts +7 -2
  262. package/pipes/format/package.json +6 -7
  263. package/pipes/format/pipe-format.d.ts +5 -0
  264. package/pipes/index.d.ts +3 -3
  265. package/pipes/package.json +6 -7
  266. package/pipes/pipes.d.ts +5 -0
  267. package/token/index.d.ts +2 -2
  268. package/token/package.json +6 -7
  269. package/token/page-visibility.d.ts +8 -8
  270. package/token/token.d.ts +5 -0
  271. package/token/window.d.ts +7 -7
  272. package/yelon-util.d.ts +5 -4
  273. package/array/yelon-util-array.metadata.json +0 -1
  274. package/browser/browser.metadata.json +0 -1
  275. package/bundles/browser.umd.js +0 -325
  276. package/bundles/browser.umd.js.map +0 -1
  277. package/bundles/yelon-util-array.umd.js +0 -641
  278. package/bundles/yelon-util-array.umd.js.map +0 -1
  279. package/bundles/yelon-util-config.umd.js +0 -411
  280. package/bundles/yelon-util-config.umd.js.map +0 -1
  281. package/bundles/yelon-util-date-time.umd.js +0 -238
  282. package/bundles/yelon-util-date-time.umd.js.map +0 -1
  283. package/bundles/yelon-util-decorator.umd.js +0 -462
  284. package/bundles/yelon-util-decorator.umd.js.map +0 -1
  285. package/bundles/yelon-util-form.umd.js +0 -135
  286. package/bundles/yelon-util-form.umd.js.map +0 -1
  287. package/bundles/yelon-util-format.umd.js +0 -785
  288. package/bundles/yelon-util-format.umd.js.map +0 -1
  289. package/bundles/yelon-util-math.umd.js +0 -104
  290. package/bundles/yelon-util-math.umd.js.map +0 -1
  291. package/bundles/yelon-util-other.umd.js +0 -714
  292. package/bundles/yelon-util-other.umd.js.map +0 -1
  293. package/bundles/yelon-util-pipes-currency.umd.js +0 -108
  294. package/bundles/yelon-util-pipes-currency.umd.js.map +0 -1
  295. package/bundles/yelon-util-pipes-filter.umd.js +0 -374
  296. package/bundles/yelon-util-pipes-filter.umd.js.map +0 -1
  297. package/bundles/yelon-util-pipes-format.umd.js +0 -66
  298. package/bundles/yelon-util-pipes-format.umd.js.map +0 -1
  299. package/bundles/yelon-util-pipes.umd.js +0 -38
  300. package/bundles/yelon-util-pipes.umd.js.map +0 -1
  301. package/bundles/yelon-util-token.umd.js +0 -49
  302. package/bundles/yelon-util-token.umd.js.map +0 -1
  303. package/bundles/yelon-util.umd.js +0 -86
  304. package/bundles/yelon-util.umd.js.map +0 -1
  305. package/config/yelon-util-config.metadata.json +0 -1
  306. package/date-time/yelon-util-date-time.metadata.json +0 -1
  307. package/decorator/yelon-util-decorator.metadata.json +0 -1
  308. package/esm2015/array/array.service.js +0 -250
  309. package/esm2015/browser/cookie.service.js +0 -104
  310. package/esm2015/browser/copy.js +0 -27
  311. package/esm2015/browser/scroll.service.js +0 -89
  312. package/esm2015/config/abc/pdf.type.js +0 -2
  313. package/esm2015/config/abc/qr.type.js +0 -2
  314. package/esm2015/config/config.service.js +0 -34
  315. package/esm2015/config/yelon-util-config.js +0 -5
  316. package/esm2015/date-time/picker.js +0 -116
  317. package/esm2015/date-time/yelon-util-date-time.js +0 -5
  318. package/esm2015/decorator/convert.js +0 -56
  319. package/esm2015/decorator/yelon-util-decorator.js +0 -5
  320. package/esm2015/decorator/zone-outside.js +0 -55
  321. package/esm2015/form/yelon-util-form.js +0 -5
  322. package/esm2015/format/currency.service.js +0 -225
  323. package/esm2015/format/string.js +0 -76
  324. package/esm2015/format/yelon-util-format.js +0 -5
  325. package/esm2015/math/yelon-util-math.js +0 -5
  326. package/esm2015/other/lazy.service.js +0 -118
  327. package/esm2015/pipes/currency/cny.pipe.js +0 -22
  328. package/esm2015/pipes/currency/mega.pipe.js +0 -26
  329. package/esm2015/pipes/currency/module.js +0 -14
  330. package/esm2015/pipes/currency/price.pipe.js +0 -26
  331. package/esm2015/pipes/currency/yelon-util-pipes-currency.js +0 -6
  332. package/esm2015/pipes/filter/filter.pipe.js +0 -15
  333. package/esm2015/pipes/filter/module.js +0 -12
  334. package/esm2015/pipes/filter/yelon-util-pipes-filter.js +0 -5
  335. package/esm2015/pipes/format/mask.pipe.js +0 -30
  336. package/esm2015/pipes/format/module.js +0 -12
  337. package/esm2015/pipes/format/yelon-util-pipes-format.js +0 -5
  338. package/esm2015/pipes/yelon-util-pipes.js +0 -5
  339. package/esm2015/token/yelon-util-token.js +0 -5
  340. package/fesm2015/browser.js.map +0 -1
  341. package/fesm2015/yelon-util-array.js.map +0 -1
  342. package/fesm2015/yelon-util-config.js.map +0 -1
  343. package/fesm2015/yelon-util-date-time.js.map +0 -1
  344. package/fesm2015/yelon-util-decorator.js.map +0 -1
  345. package/fesm2015/yelon-util-form.js.map +0 -1
  346. package/fesm2015/yelon-util-format.js.map +0 -1
  347. package/fesm2015/yelon-util-math.js.map +0 -1
  348. package/fesm2015/yelon-util-pipes-currency.js +0 -87
  349. package/fesm2015/yelon-util-pipes-currency.js.map +0 -1
  350. package/fesm2015/yelon-util-pipes-filter.js +0 -32
  351. package/fesm2015/yelon-util-pipes-filter.js.map +0 -1
  352. package/fesm2015/yelon-util-pipes-format.js +0 -47
  353. package/fesm2015/yelon-util-pipes-format.js.map +0 -1
  354. package/fesm2015/yelon-util-pipes.js.map +0 -1
  355. package/fesm2015/yelon-util-token.js.map +0 -1
  356. package/fesm2015/yelon-util.js.map +0 -1
  357. package/form/yelon-util-form.d.ts +0 -4
  358. package/form/yelon-util-form.metadata.json +0 -1
  359. package/format/yelon-util-format.d.ts +0 -4
  360. package/format/yelon-util-format.metadata.json +0 -1
  361. package/math/yelon-util-math.d.ts +0 -4
  362. package/math/yelon-util-math.metadata.json +0 -1
  363. package/other/yelon-util-other.d.ts +0 -4
  364. package/other/yelon-util-other.metadata.json +0 -1
  365. package/pipes/currency/yelon-util-pipes-currency.d.ts +0 -5
  366. package/pipes/currency/yelon-util-pipes-currency.metadata.json +0 -1
  367. package/pipes/filter/yelon-util-pipes-filter.d.ts +0 -4
  368. package/pipes/filter/yelon-util-pipes-filter.metadata.json +0 -1
  369. package/pipes/format/yelon-util-pipes-format.d.ts +0 -4
  370. package/pipes/format/yelon-util-pipes-format.metadata.json +0 -1
  371. package/pipes/yelon-util-pipes.d.ts +0 -4
  372. package/pipes/yelon-util-pipes.metadata.json +0 -1
  373. package/token/yelon-util-token.d.ts +0 -4
  374. package/token/yelon-util-token.metadata.json +0 -1
  375. package/yelon-util.metadata.json +0 -1
@@ -0,0 +1,85 @@
1
+ import { deepGet } from '@yelon/util/other';
2
+ /**
3
+ * String formatting
4
+ *
5
+ * 字符串格式化
6
+ * ```
7
+ * format('this is ${name}', { name: 'asdf' })
8
+ * // output: this is asdf
9
+ * format('this is ${user.name}', { user: { name: 'asdf' } }, true)
10
+ * // output: this is asdf
11
+ * ```
12
+ */
13
+ export function format(str, obj, needDeepGet = false) {
14
+ return (str || '').replace(/\${([^}]+)}/g, (_work, key) => needDeepGet ? deepGet(obj, key.split('.'), '') : (obj || {})[key] || '');
15
+ }
16
+ /**
17
+ * Format mask
18
+ *
19
+ * 格式化掩码
20
+ *
21
+ * | 字符 | 描述 |
22
+ * | --- | --- |
23
+ * | `0` | 任意数字,若该位置字符不符合,则默认为 `0` 填充 |
24
+ * | `9` | 任意数字 |
25
+ * | `#` | 任意字符 |
26
+ * | `U` | 转换大写 |
27
+ * | `L` | 转换小写 |
28
+ * | `*` | 转换为 `*` 字符 |
29
+ *
30
+ * ```ts
31
+ * formatMask('123', '(###)') => (123)
32
+ * formatMask('15900000000', '999****9999') => 159****0000
33
+ * ```
34
+ */
35
+ export function formatMask(value, option) {
36
+ if (!value) {
37
+ return '';
38
+ }
39
+ const opt = {
40
+ ...(typeof option === 'string' ? { mask: option } : option)
41
+ };
42
+ const tokens = {
43
+ '0': { pattern: /\d/, default: '0' },
44
+ '9': { pattern: /\d/ },
45
+ '#': { pattern: /[a-zA-Z0-9]/ },
46
+ U: {
47
+ pattern: /[a-zA-Z]/,
48
+ transform: char => char.toLocaleUpperCase()
49
+ },
50
+ L: {
51
+ pattern: /[a-zA-Z]/,
52
+ transform: char => char.toLocaleLowerCase()
53
+ },
54
+ '*': {
55
+ pattern: /.*/,
56
+ transform: _ => `*`
57
+ },
58
+ ...opt.tokens
59
+ };
60
+ const splitValue = value.split('');
61
+ return opt.mask
62
+ .split('')
63
+ .reduce((res, cur) => {
64
+ const token = tokens[cur];
65
+ if (!token) {
66
+ res.push(cur);
67
+ return res;
68
+ }
69
+ const value = splitValue.shift() ?? '';
70
+ if (!token.pattern.test(value)) {
71
+ if (token.default)
72
+ res.push(token.default);
73
+ return res;
74
+ }
75
+ if (typeof token.transform === 'function') {
76
+ res.push(token.transform(value));
77
+ }
78
+ else {
79
+ res.push(value);
80
+ }
81
+ return res;
82
+ }, [])
83
+ .join('');
84
+ }
85
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5nLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9mb3JtYXQvc3RyaW5nLnRzIl0sIm5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gPSB2YWx1ZS5zcGxpdCgnJyk7XG4gIHJldHVybiBvcHQubWFza1xuICAgIC5zcGxpdCgnJylcbiAgICAucmVkdWNlKChyZXMsIGN1cikgPT4ge1xuICAgICAgY29uc3QgdG9rZW4gPSB0b2tlbnNbY3VyXTtcbiAgICAgIGlmICghdG9rZW4pIHtcbiAgICAgICAgcmVzLnB1c2goY3VyKTtcbiAgICAgICAgcmV0dXJuIHJlcztcbiAgICAgIH1cblxuICAgICAgY29uc3QgdmFsdWUgPSBzcGxpdFZhbHVlLnNoaWZ0KCkgPz8gJyc7XG4gICAgICBpZiAoIXRva2VuLnBhdHRlcm4udGVzdCh2YWx1ZSkpIHtcbiAgICAgICAgaWYgKHRva2VuLmRlZmF1bHQpIHJlcy5wdXNoKHRva2VuLmRlZmF1bHQpO1xuICAgICAgICByZXR1cm4gcmVzO1xuICAgICAgfVxuXG4gICAgICBpZiAodHlwZW9mIHRva2VuLnRyYW5zZm9ybSA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICByZXMucHVzaCh0b2tlbi50cmFuc2Zvcm0odmFsdWUpKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHJlcy5wdXNoKHZhbHVlKTtcbiAgICAgIH1cbiAgICAgIHJldHVybiByZXM7XG4gICAgfSwgW10gYXMgc3RyaW5nW10pXG4gICAgLmpvaW4oJycpO1xufVxuIl19
@@ -1,94 +1,94 @@
1
- export const REGEX_STR = {
2
- num: `((-?\\d+\\.\\d+)|(-?\\d+)|(-?\\.\\d+))`,
3
- idCard: `(^\\d{15}$)|(^\\d{17}(?:[0-9]|X)$)`,
4
- mobile: `^(0|\\+?86|17951)?1[0-9]{10}$`,
5
- url: `(((^https?:(?:\/\/)?)(?:[-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9.-]+(?::\\d+)?|(?:www.|[-;:&=\\+\\$,\\w]+@)[A-Za-z0-9.-]+)((?:\/[\\+~%\\/.\\w-_]*)?\\??(?:[-\\+=&;%@.\\w_]*)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(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)`,
7
- color: `(?:#|0x)(?:[a-f0-9]{3}|[a-f0-9]{6})\\b|(?:rgb|hsl)a?\\([^\\)]*\\)`,
8
- chinese: `[\u4e00-\u9fa5]+`
9
- };
10
- function genRegex(str, flags) {
11
- return new RegExp(`^${str}$`, flags);
12
- }
13
- export const REGEX = {
14
- num: genRegex(REGEX_STR.num),
15
- idCard: genRegex(REGEX_STR.idCard, 'i'),
16
- mobile: genRegex(REGEX_STR.mobile),
17
- url: genRegex(REGEX_STR.url),
18
- ip: genRegex(REGEX_STR.ip),
19
- color: genRegex(REGEX_STR.color),
20
- chinese: genRegex(REGEX_STR.chinese)
21
- };
22
- /**
23
- * Wheter is number
24
- *
25
- * 是否为数字
26
- */
27
- export function isNum(value) {
28
- return REGEX.num.test(value.toString());
29
- }
30
- /**
31
- * Wheter is integer
32
- *
33
- * 是否为整数
34
- */
35
- export function isInt(value) {
36
- return isNum(value) && parseInt(value.toString(), 10).toString() === value.toString();
37
- }
38
- /**
39
- * Wheter is decimal
40
- *
41
- * 是否为小数点数值
42
- */
43
- export function isDecimal(value) {
44
- return isNum(value) && !isInt(value);
45
- }
46
- /**
47
- * Wheter is People's Republic of China identity card
48
- *
49
- * 是否为中华人民共和国居民身份证
50
- */
51
- export function isIdCard(value) {
52
- return REGEX.idCard.test(value);
53
- }
54
- /**
55
- * Wheter is china mobile (China)
56
- *
57
- * 是否为手机号(中国)
58
- */
59
- export function isMobile(value) {
60
- return REGEX.mobile.test(value);
61
- }
62
- /**
63
- * Wheter is url address
64
- *
65
- * 是否URL地址
66
- */
67
- export function isUrl(url) {
68
- return REGEX.url.test(url);
69
- }
70
- /**
71
- * Wheter is IPv4 address (Support v4, v6)
72
- *
73
- * 是否IP4地址(支持v4、v6)
74
- */
75
- export function isIp(ip) {
76
- return REGEX.ip.test(ip);
77
- }
78
- /**
79
- * Wheter is color
80
- *
81
- * 是否颜色代码值
82
- */
83
- export function isColor(color) {
84
- return REGEX.color.test(color);
85
- }
86
- /**
87
- * Wheter is chinese
88
- *
89
- * 是否中文
90
- */
91
- export function isChinese(value) {
92
- return REGEX.chinese.test(value);
93
- }
1
+ export const REGEX_STR = {
2
+ num: `((-?\\d+\\.\\d+)|(-?\\d+)|(-?\\.\\d+))`,
3
+ idCard: `(^\\d{15}$)|(^\\d{17}(?:[0-9]|X)$)`,
4
+ mobile: `^(0|\\+?86|17951)?1[0-9]{10}$`,
5
+ url: `(((^https?:(?:\/\/)?)(?:[-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9.-]+(?::\\d+)?|(?:www.|[-;:&=\\+\\$,\\w]+@)[A-Za-z0-9.-]+)((?:\/[\\+~%\\/.\\w-_]*)?\\??(?:[-\\+=&;%@.\\w_]*)#?(?:[\\w]*))?)`,
6
+ ip: `(?:^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$)|(?:^(?:(?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)|(?:[a-fA-F\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|:[a-fA-F\\d]{1,4}|:)|(?:[a-fA-F\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\d|1\\d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\\)`,
8
+ chinese: `[\u4e00-\u9fa5]+`
9
+ };
10
+ function genRegex(str, flags) {
11
+ return new RegExp(`^${str}$`, flags);
12
+ }
13
+ export const REGEX = {
14
+ num: genRegex(REGEX_STR.num),
15
+ idCard: genRegex(REGEX_STR.idCard, 'i'),
16
+ mobile: genRegex(REGEX_STR.mobile),
17
+ url: genRegex(REGEX_STR.url),
18
+ ip: genRegex(REGEX_STR.ip),
19
+ color: genRegex(REGEX_STR.color),
20
+ chinese: genRegex(REGEX_STR.chinese)
21
+ };
22
+ /**
23
+ * Wheter is number
24
+ *
25
+ * 是否为数字
26
+ */
27
+ export function isNum(value) {
28
+ return REGEX.num.test(value.toString());
29
+ }
30
+ /**
31
+ * Wheter is integer
32
+ *
33
+ * 是否为整数
34
+ */
35
+ export function isInt(value) {
36
+ return isNum(value) && parseInt(value.toString(), 10).toString() === value.toString();
37
+ }
38
+ /**
39
+ * Wheter is decimal
40
+ *
41
+ * 是否为小数点数值
42
+ */
43
+ export function isDecimal(value) {
44
+ return isNum(value) && !isInt(value);
45
+ }
46
+ /**
47
+ * Wheter is People's Republic of China identity card
48
+ *
49
+ * 是否为中华人民共和国居民身份证
50
+ */
51
+ export function isIdCard(value) {
52
+ return REGEX.idCard.test(value);
53
+ }
54
+ /**
55
+ * Wheter is china mobile (China)
56
+ *
57
+ * 是否为手机号(中国)
58
+ */
59
+ export function isMobile(value) {
60
+ return REGEX.mobile.test(value);
61
+ }
62
+ /**
63
+ * Wheter is url address
64
+ *
65
+ * 是否URL地址
66
+ */
67
+ export function isUrl(url) {
68
+ return REGEX.url.test(url);
69
+ }
70
+ /**
71
+ * Wheter is IPv4 address (Support v4, v6)
72
+ *
73
+ * 是否IP4地址(支持v4、v6)
74
+ */
75
+ export function isIp(ip) {
76
+ return REGEX.ip.test(ip);
77
+ }
78
+ /**
79
+ * Wheter is color
80
+ *
81
+ * 是否颜色代码值
82
+ */
83
+ export function isColor(color) {
84
+ return REGEX.color.test(color);
85
+ }
86
+ /**
87
+ * Wheter is chinese
88
+ *
89
+ * 是否中文
90
+ */
91
+ export function isChinese(value) {
92
+ return REGEX.chinese.test(value);
93
+ }
94
94
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Zvcm1hdC92YWxpZGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQUMsTUFBTSxTQUFTLEdBQUc7SUFDdkIsR0FBRyxFQUFFLHdDQUF3QztJQUM3QyxNQUFNLEVBQUUsb0NBQW9DO0lBQzVDLE1BQU0sRUFBRSwrQkFBK0I7SUFDdkMsR0FBRyxFQUFFLG9MQUFvTDtJQUN6TCxFQUFFLEVBQUUsdzBDQUF3MEM7SUFDNTBDLEtBQUssRUFBRSxtRUFBbUU7SUFDMUUsT0FBTyxFQUFFLGtCQUFrQjtDQUM1QixDQUFDO0FBRUYsU0FBUyxRQUFRLENBQUMsR0FBVyxFQUFFLEtBQWM7SUFDM0MsT0FBTyxJQUFJLE1BQU0sQ0FBQyxJQUFJLEdBQUcsR0FBRyxFQUFFLEtBQUssQ0FBQyxDQUFDO0FBQ3ZDLENBQUM7QUFFRCxNQUFNLENBQUMsTUFBTSxLQUFLLEdBQUc7SUFDbkIsR0FBRyxFQUFFLFFBQVEsQ0FBQyxTQUFTLENBQUMsR0FBRyxDQUFDO0lBQzVCLE1BQU0sRUFBRSxRQUFRLENBQUMsU0FBUyxDQUFDLE1BQU0sRUFBRSxHQUFHLENBQUM7SUFDdkMsTUFBTSxFQUFFLFFBQVEsQ0FBQyxTQUFTLENBQUMsTUFBTSxDQUFDO0lBQ2xDLEdBQUcsRUFBRSxRQUFRLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQztJQUM1QixFQUFFLEVBQUUsUUFBUSxDQUFDLFNBQV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gKiBXaGV0ZXIgaXMgSVB2NCBhZGRyZXNzIChTdXBwb3J0IHY0LCB2NilcbiAqXG4gKiDmmK/lkKZJUDTlnLDlnYDvvIjmlK/mjIF2NOOAgXY277yJXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBpc0lwKGlwOiBzdHJpbmcpOiBib29sZWFuIHtcbiAgcmV0dXJuIFJFR0VYLmlwLnRlc3QoaXApO1xufVxuXG4vKipcbiAqIFdoZXRlciBpcyBjb2xvclxuICpcbiAqIOaYr+WQpuminOiJsuS7o+eggeWAvFxuICovXG5leHBvcnQgZnVuY3Rpb24gaXNDb2xvcihjb2xvcjogc3RyaW5nKTogYm9vbGVhbiB7XG4gIHJldHVybiBSRUdFWC5jb2xvci50ZXN0KGNvbG9yKTtcbn1cblxuLyoqXG4gKiBXaGV0ZXIgaXMgY2hpbmVzZVxuICpcbiAqIOaYr+WQpuS4reaWh1xuICovXG5leHBvcnQgZnVuY3Rpb24gaXNDaGluZXNlKHZhbHVlOiBzdHJpbmcpOiBib29sZWFuIHtcbiAgcmV0dXJuIFJFR0VYLmNoaW5lc2UudGVzdCh2YWx1ZSk7XG59XG4iXX0=
@@ -1,12 +1,12 @@
1
- export * from '@yelon/util/array';
2
- export * from '@yelon/util/browser';
3
- export * from '@yelon/util/config';
4
- export * from '@yelon/util/date-time';
5
- export * from '@yelon/util/form';
6
- export * from '@yelon/util/format';
7
- export * from '@yelon/util/math';
8
- export * from '@yelon/util/decorator';
9
- export * from '@yelon/util/other';
10
- export * from '@yelon/util/pipes';
11
- export * from '@yelon/util/token';
1
+ export * from '@yelon/util/array';
2
+ export * from '@yelon/util/browser';
3
+ export * from '@yelon/util/config';
4
+ export * from '@yelon/util/date-time';
5
+ export * from '@yelon/util/form';
6
+ export * from '@yelon/util/format';
7
+ export * from '@yelon/util/math';
8
+ export * from '@yelon/util/decorator';
9
+ export * from '@yelon/util/other';
10
+ export * from '@yelon/util/pipes';
11
+ export * from '@yelon/util/token';
12
12
  //# sourceM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ic7XG4iXX0=
@@ -1,25 +1,25 @@
1
- import { assertNumber } from '@yelon/util/other';
2
- /**
3
- * Checks if `value` is between `start` and `end` to, but not including `end`. If `end` is not specified, it's set to start with `start` then set to `0`. If `start` is greater than `end` the params are swapped to support negative ranges.
4
- *
5
- * 检查 `value` 是否在 `start` 与 `end` 之间,但不包括 `end`。 如果 `end` 没有指定,那么 `start` 设置为 `0`。 如果 `start` 大于 `end`,那么参数会交换以便支持负范围。
6
- * ```ts
7
- * inRange(3, 2, 4); // true
8
- * inRange(4, 8); // true
9
- * inRange(4, 2); // false
10
- * inRange(2, 2); // false
11
- * inRange(1.2, 2); // true
12
- * inRange(-3, -2, -6); // true
13
- * ```
14
- */
15
- export function inRange(value, start, end) {
16
- if (end === undefined) {
17
- end = start;
18
- start = 0;
19
- }
20
- assertNumber(value);
21
- assertNumber(start);
22
- assertNumber(end);
23
- return value >= Math.min(start, end) && value < Math.max(start, end);
24
- }
1
+ import { assertNumber } from '@yelon/util/other';
2
+ /**
3
+ * Checks if `value` is between `start` and `end` to, but not including `end`. If `end` is not specified, it's set to start with `start` then set to `0`. If `start` is greater than `end` the params are swapped to support negative ranges.
4
+ *
5
+ * 检查 `value` 是否在 `start` 与 `end` 之间,但不包括 `end`。 如果 `end` 没有指定,那么 `start` 设置为 `0`。 如果 `start` 大于 `end`,那么参数会交换以便支持负范围。
6
+ * ```ts
7
+ * inRange(3, 2, 4); // true
8
+ * inRange(4, 8); // true
9
+ * inRange(4, 2); // false
10
+ * inRange(2, 2); // false
11
+ * inRange(1.2, 2); // true
12
+ * inRange(-3, -2, -6); // true
13
+ * ```
14
+ */
15
+ export function inRange(value, start, end) {
16
+ if (end === undefined) {
17
+ end = start;
18
+ start = 0;
19
+ }
20
+ assertNumber(value);
21
+ assertNumber(start);
22
+ assertNumber(end);
23
+ return value >= Math.min(start, end) && value < Math.max(start, end);
24
+ }
25
25
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoia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@
1
- export * from './in-range';
2
- export * from './round';
1
+ export * from './in-range';
2
+ export * from './round';
3
3
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL21hdGgvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxZQUFZLENBQUM7QUFDM0IsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2luLXJhbmdlJztcbmV4cG9ydCAqIGZyb20gJy4vcm91bmQnO1xuIl19
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWF0aC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvbWF0aC9tYXRoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
@@ -1,53 +1,53 @@
1
- /**
2
- * Computes `number` rounded up to `precision`.
3
- *
4
- * 根据 `precision`(精度) 向上舍入 `number`。
5
- * ```ts
6
- * ceil(4.006); // 5
7
- * ceil(6.004, 2); // 6.01
8
- * ceil(6040, -2); // 6100
9
- * ```
10
- */
11
- export function ceil(number, precision = 0) {
12
- return createRound(number, precision, 'ceil');
13
- }
14
- /**
15
- * Computes `number` rounded down to `precision`.
16
- *
17
- * 根据 `precision`(精度) 向下舍入 `number`。
18
- * ```ts
19
- * floor(4.006); // 4
20
- * floor(0.046, 2); // 0.04
21
- * floor(4060, -2); // 4000
22
- * ```
23
- */
24
- export function floor(number, precision = 0) {
25
- return createRound(number, precision, 'floor');
26
- }
27
- /**
28
- * Computes `number` rounded to `precision`.
29
- *
30
- * 根据 `precision`(精度) 四舍五入 `number`。
31
- * ```ts
32
- * round(4.006); // 4
33
- * round(4.006, 2); // 4.01
34
- * round(4060, -2); // 4100
35
- * ```
36
- */
37
- export function round(number, precision = 0) {
38
- return createRound(number, precision, 'round');
39
- }
40
- function createRound(number, precision, methodName) {
41
- const func = Math[methodName];
42
- precision = precision == null ? 0 : Math.min(precision, 292);
43
- if (!precision) {
44
- return func(number);
45
- }
46
- // Shift with exponential notation to avoid floating-point issues.
47
- // See [MDN](https://mdn.io/round#Examples) for more details.
48
- let pair = `${number}e`.split('e');
49
- const value = func(Number(`${pair[0]}e${Number(pair[1]) + precision}`));
50
- pair = `${value}e`.split('e');
51
- return Number(`${pair[0]}e${Number(pair[1]) - precision}`);
52
- }
1
+ /**
2
+ * Computes `number` rounded up to `precision`.
3
+ *
4
+ * 根据 `precision`(精度) 向上舍入 `number`。
5
+ * ```ts
6
+ * ceil(4.006); // 5
7
+ * ceil(6.004, 2); // 6.01
8
+ * ceil(6040, -2); // 6100
9
+ * ```
10
+ */
11
+ export function ceil(number, precision = 0) {
12
+ return createRound(number, precision, 'ceil');
13
+ }
14
+ /**
15
+ * Computes `number` rounded down to `precision`.
16
+ *
17
+ * 根据 `precision`(精度) 向下舍入 `number`。
18
+ * ```ts
19
+ * floor(4.006); // 4
20
+ * floor(0.046, 2); // 0.04
21
+ * floor(4060, -2); // 4000
22
+ * ```
23
+ */
24
+ export function floor(number, precision = 0) {
25
+ return createRound(number, precision, 'floor');
26
+ }
27
+ /**
28
+ * Computes `number` rounded to `precision`.
29
+ *
30
+ * 根据 `precision`(精度) 四舍五入 `number`。
31
+ * ```ts
32
+ * round(4.006); // 4
33
+ * round(4.006, 2); // 4.01
34
+ * round(4060, -2); // 4100
35
+ * ```
36
+ */
37
+ export function round(number, precision = 0) {
38
+ return createRound(number, precision, 'round');
39
+ }
40
+ function createRound(number, precision, methodName) {
41
+ const func = Math[methodName];
42
+ precision = precision == null ? 0 : Math.min(precision, 292);
43
+ if (!precision) {
44
+ return func(number);
45
+ }
46
+ // Shift with exponential notation to avoid floating-point issues.
47
+ // See [MDN](https://mdn.io/round#Examples) for more details.
48
+ let pair = `${number}e`.split('e');
49
+ const value = func(Number(`${pair[0]}e${Number(pair[1]) + precision}`));
50
+ pair = `${value}e`.split('e');
51
+ return Number(`${pair[0]}e${Number(pair[1]) - precision}`);
52
+ }
53
53
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91bmQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL21hdGgvcm91bmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7OztHQVNHO0FBQ0gsTUFBTSxVQUFVLElBQUksQ0FBQyxNQUFjLEVBQUUsWUFBb0IsQ0FBQztJQUN4RCxPQUFPLFdBQVcsQ0FBQyxNQUFNLEVBQUUsU0FBUyxFQUFFLE1BQU0sQ0FBQyxDQUFDO0FBQ2hELENBQUM7QUFFRDs7Ozs7Ozs7O0dBU0c7QUFDSCxNQUFNLFVBQVUsS0FBSyxDQUFDLE1BQWMsRUFBRSxZQUFvQixDQUFDO0lBQ3pELE9BQU8sV0FBVyxDQUFDLE1BQU0sRUFBRSxTQUFTLEVBQUUsT0FBTyxDQUFDLENBQUM7QUFDakQsQ0FBQztBQUVEOzs7Ozs7Ozs7R0FTRztBQUNILE1BQU0sVUFBVSxLQUFLLENBQUMsTUFBYyxFQUFFLFlBQW9CLENBQUM7SUFDekQsT0FBTyxXQUFXLENBQUMsTUFBTSxFQU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Observable } from 'rxjs';
2
- function throwError(msg, actual, expected, comparison) {
3
- if (ngDevMode) {
4
- throw new Error(`ASSERTION ERROR: ${msg}${comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`}`);
5
- }
6
- }
7
- /**
8
- * Assert whether the expression and throw an error into console in dev mode
9
- *
10
- * 断言表达式是否符合预期,并在开发模式下会在控制台抛出一个错误
11
- */
12
- export function assert(expression, msg) {
13
- if (!expression) {
14
- throwError(msg);
15
- }
16
- }
17
- /**
18
- * Assert whether empty (`null` or `undefined`)
19
- *
20
- * 断言是否空值(`null` 或 `undefined`)
21
- */
22
- export function assertEmpty(actual, msg) {
23
- if (actual == null) {
24
- throwError(msg, typeof actual, 'NULL', '==');
25
- }
26
- }
27
- /**
28
- * Assert whether `number` type
29
- *
30
- * 断言是否 `number` 类型
31
- */
32
- export function assertNumber(actual, msg) {
33
- if (!(typeof actual === 'number')) {
34
- throwError(msg, typeof actual, 'number', '===');
35
- }
36
- }
37
- /**
38
- * Assert whether `string` type
39
- *
40
- * 断言是否 `string` 类型
41
- */
42
- export function assertString(actual, msg) {
43
- if (!(typeof actual === 'string')) {
44
- throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');
45
- }
46
- }
47
- /**
48
- * Assert whether `array` type
49
- *
50
- * 断言是否 `array` 类型
51
- */
52
- export function assertArray(actual, msg) {
53
- if (!Array.isArray(actual)) {
54
- throwError(msg, actual === null ? 'null' : typeof actual, 'array', '===');
55
- }
56
- }
57
- /**
58
- * Assert whether `Observable` type
59
- *
60
- * 断言是否 `Observable` 类型
61
- */
62
- export function assertObservable(obj, msg) {
63
- if (!isObservable(obj)) {
64
- throwError(msg, obj === null ? 'null' : typeof obj, 'Observable', '===');
65
- }
66
- }
1
+ import { isObservable } from 'rxjs';
2
+ function throwError(msg, actual, expected, comparison) {
3
+ if (ngDevMode) {
4
+ throw new Error(`ASSERTION ERROR: ${msg}${comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`}`);
5
+ }
6
+ }
7
+ /**
8
+ * Assert whether the expression and throw an error into console in dev mode
9
+ *
10
+ * 断言表达式是否符合预期,并在开发模式下会在控制台抛出一个错误
11
+ */
12
+ export function assert(expression, msg) {
13
+ if (!expression) {
14
+ throwError(msg);
15
+ }
16
+ }
17
+ /**
18
+ * Assert whether empty (`null` or `undefined`)
19
+ *
20
+ * 断言是否空值(`null` 或 `undefined`)
21
+ */
22
+ export function assertEmpty(actual, msg) {
23
+ if (actual == null) {
24
+ throwError(msg, typeof actual, 'NULL', '==');
25
+ }
26
+ }
27
+ /**
28
+ * Assert whether `number` type
29
+ *
30
+ * 断言是否 `number` 类型
31
+ */
32
+ export function assertNumber(actual, msg) {
33
+ if (!(typeof actual === 'number')) {
34
+ throwError(msg, typeof actual, 'number', '===');
35
+ }
36
+ }
37
+ /**
38
+ * Assert whether `string` type
39
+ *
40
+ * 断言是否 `string` 类型
41
+ */
42
+ export function assertString(actual, msg) {
43
+ if (!(typeof actual === 'string')) {
44
+ throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');
45
+ }
46
+ }
47
+ /**
48
+ * Assert whether `array` type
49
+ *
50
+ * 断言是否 `array` 类型
51
+ */
52
+ export function assertArray(actual, msg) {
53
+ if (!Array.isArray(actual)) {
54
+ throwError(msg, actual === null ? 'null' : typeof actual, 'array', '===');
55
+ }
56
+ }
57
+ /**
58
+ * Assert whether `Observable` type
59
+ *
60
+ * 断言是否 `Observable` 类型
61
+ */
62
+ export function assertObservable(obj, msg) {
63
+ if (!isObservable(obj)) {
64
+ throwError(msg, obj === null ? 'null' : typeof obj, 'Observable', '===');
65
+ }
66
+ }
67
67
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXJ0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9vdGhlci9hc3NlcnQudHMiXSwibmFtZXMiO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