@yelon/util 17.3.1 → 18.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +27 -27
  3. package/array/array-type.service.d.ts +68 -68
  4. package/array/array.service.d.ts +78 -78
  5. package/array/index.d.ts +2 -2
  6. package/browser/cookie.service.d.ts +64 -64
  7. package/browser/copy.d.ts +6 -6
  8. package/browser/index.d.ts +5 -5
  9. package/browser/is-empty.d.ts +6 -6
  10. package/browser/scroll.service.d.ts +34 -34
  11. package/browser/style.d.ts +21 -21
  12. package/config/abc/cell.type.d.ts +118 -118
  13. package/config/abc/date-picker.type.d.ts +52 -52
  14. package/config/abc/error-collect.type.d.ts +10 -10
  15. package/config/abc/exception.type.d.ts +9 -9
  16. package/config/abc/image.type.d.ts +15 -15
  17. package/config/abc/index.d.ts +17 -18
  18. package/config/abc/loading.type.d.ts +31 -31
  19. package/config/abc/lodop.type.d.ts +33 -33
  20. package/config/abc/media.type.d.ts +11 -11
  21. package/config/abc/onboarding.type.d.ts +4 -4
  22. package/config/abc/page-header.type.d.ts +39 -39
  23. package/config/abc/pdf.type.d.ts +35 -35
  24. package/config/abc/se.type.d.ts +32 -32
  25. package/config/abc/sg.type.d.ts +10 -10
  26. package/config/abc/st.type.d.ts +465 -465
  27. package/config/abc/sv.type.d.ts +14 -14
  28. package/config/abc/xlsx.type.d.ts +12 -12
  29. package/config/abc/zip.type.d.ts +10 -10
  30. package/config/acl/acl.type.d.ts +32 -32
  31. package/config/auth/auth.type.d.ts +51 -51
  32. package/config/bis/bis.type.d.ts +11 -11
  33. package/config/cache/cache.type.d.ts +66 -66
  34. package/config/chart/chart.type.d.ts +33 -33
  35. package/config/config.service.d.ts +13 -13
  36. package/config/config.types.d.ts +51 -52
  37. package/config/index.d.ts +14 -14
  38. package/config/mock/mock.type.d.ts +14 -14
  39. package/config/sf/sf.type.d.ts +133 -133
  40. package/config/socket/socket.type.d.ts +4 -4
  41. package/config/theme/http.type.d.ts +15 -15
  42. package/config/theme/i18n.type.d.ts +14 -14
  43. package/config/theme/index.d.ts +3 -3
  44. package/config/theme/pipe.type.d.ts +3 -3
  45. package/config/theme/responsive.type.d.ts +12 -12
  46. package/config/util/array.type.d.ts +22 -22
  47. package/config/util/currency.type.d.ts +39 -39
  48. package/date-time/index.d.ts +2 -2
  49. package/date-time/picker.d.ts +68 -68
  50. package/date-time/time.d.ts +39 -39
  51. package/decorator/convert.d.ts +32 -32
  52. package/decorator/index.d.ts +2 -2
  53. package/decorator/zone-outside.d.ts +35 -35
  54. package/esm2022/array/array-type.service.mjs +1 -1
  55. package/esm2022/array/array.mjs +4 -4
  56. package/esm2022/array/array.service.mjs +277 -277
  57. package/esm2022/array/index.mjs +2 -2
  58. package/esm2022/browser/browser.mjs +4 -4
  59. package/esm2022/browser/cookie.service.mjs +99 -99
  60. package/esm2022/browser/copy.mjs +27 -27
  61. package/esm2022/browser/index.mjs +5 -5
  62. package/esm2022/browser/is-empty.mjs +18 -18
  63. package/esm2022/browser/scroll.service.mjs +84 -84
  64. package/esm2022/browser/style.mjs +37 -37
  65. package/esm2022/config/abc/cell.type.mjs +1 -1
  66. package/esm2022/config/abc/date-picker.type.mjs +1 -1
  67. package/esm2022/config/abc/error-collect.type.mjs +1 -1
  68. package/esm2022/config/abc/exception.type.mjs +1 -1
  69. package/esm2022/config/abc/image.type.mjs +1 -1
  70. package/esm2022/config/abc/index.mjs +18 -19
  71. package/esm2022/config/abc/loading.type.mjs +1 -1
  72. package/esm2022/config/abc/lodop.type.mjs +1 -1
  73. package/esm2022/config/abc/media.type.mjs +1 -1
  74. package/esm2022/config/abc/onboarding.type.mjs +1 -1
  75. package/esm2022/config/abc/page-header.type.mjs +1 -1
  76. package/esm2022/config/abc/pdf.type.mjs +1 -1
  77. package/esm2022/config/abc/se.type.mjs +1 -1
  78. package/esm2022/config/abc/sg.type.mjs +1 -1
  79. package/esm2022/config/abc/st.type.mjs +1 -1
  80. package/esm2022/config/abc/sv.type.mjs +2 -2
  81. package/esm2022/config/abc/xlsx.type.mjs +1 -1
  82. package/esm2022/config/abc/zip.type.mjs +1 -1
  83. package/esm2022/config/acl/acl.type.mjs +1 -1
  84. package/esm2022/config/auth/auth.type.mjs +1 -1
  85. package/esm2022/config/bis/bis.type.mjs +1 -1
  86. package/esm2022/config/cache/cache.type.mjs +1 -1
  87. package/esm2022/config/chart/chart.type.mjs +1 -1
  88. package/esm2022/config/config.mjs +4 -4
  89. package/esm2022/config/config.service.mjs +37 -37
  90. package/esm2022/config/config.types.mjs +12 -12
  91. package/esm2022/config/index.mjs +14 -14
  92. package/esm2022/config/mock/mock.type.mjs +1 -1
  93. package/esm2022/config/sf/sf.type.mjs +1 -1
  94. package/esm2022/config/socket/socket.type.mjs +1 -1
  95. package/esm2022/config/theme/http.type.mjs +1 -1
  96. package/esm2022/config/theme/i18n.type.mjs +1 -1
  97. package/esm2022/config/theme/index.mjs +3 -3
  98. package/esm2022/config/theme/pipe.type.mjs +1 -1
  99. package/esm2022/config/theme/responsive.type.mjs +1 -1
  100. package/esm2022/config/util/array.type.mjs +1 -1
  101. package/esm2022/config/util/currency.type.mjs +1 -1
  102. package/esm2022/date-time/date-time.mjs +4 -4
  103. package/esm2022/date-time/index.mjs +2 -2
  104. package/esm2022/date-time/picker.mjs +115 -115
  105. package/esm2022/date-time/time.mjs +100 -100
  106. package/esm2022/decorator/convert.mjs +65 -65
  107. package/esm2022/decorator/decorator.mjs +4 -4
  108. package/esm2022/decorator/index.mjs +2 -2
  109. package/esm2022/decorator/zone-outside.mjs +56 -56
  110. package/esm2022/form/form.mjs +4 -4
  111. package/esm2022/form/index.mjs +2 -2
  112. package/esm2022/form/match-control.mjs +29 -29
  113. package/esm2022/form/validators.mjs +80 -80
  114. package/esm2022/format/currency.service.mjs +232 -232
  115. package/esm2022/format/currency.types.mjs +7 -7
  116. package/esm2022/format/format.mjs +4 -4
  117. package/esm2022/format/index.mjs +4 -4
  118. package/esm2022/format/string.mjs +84 -84
  119. package/esm2022/format/validate.mjs +93 -93
  120. package/esm2022/index.mjs +13 -13
  121. package/esm2022/math/in-range.mjs +24 -24
  122. package/esm2022/math/index.mjs +2 -2
  123. package/esm2022/math/math.mjs +4 -4
  124. package/esm2022/math/round.mjs +52 -52
  125. package/esm2022/mcache/index.mjs +1 -1
  126. package/esm2022/mcache/localStorageUtils.mjs +58 -58
  127. package/esm2022/mcache/mcache.mjs +4 -4
  128. package/esm2022/mtypes/authority.type.mjs +1 -1
  129. package/esm2022/mtypes/header-menu.type.mjs +1 -1
  130. package/esm2022/mtypes/index.mjs +9 -9
  131. package/esm2022/mtypes/menu.type.mjs +1 -1
  132. package/esm2022/mtypes/mtypes.mjs +4 -4
  133. package/esm2022/mtypes/nav.types.mjs +8 -8
  134. package/esm2022/mtypes/page.mjs +41 -41
  135. package/esm2022/mtypes/project-info.types.mjs +1 -1
  136. package/esm2022/mtypes/response.mjs +1 -1
  137. package/esm2022/mtypes/role.type.mjs +1 -1
  138. package/esm2022/mtypes/user.types.mjs +1 -1
  139. package/esm2022/other/assert.mjs +66 -66
  140. package/esm2022/other/deep.mjs +77 -77
  141. package/esm2022/other/favicon.mjs +28 -28
  142. package/esm2022/other/index.mjs +7 -7
  143. package/esm2022/other/lazy.service.mjs +128 -128
  144. package/esm2022/other/logger.mjs +32 -32
  145. package/esm2022/other/other.mjs +4 -4
  146. package/esm2022/other/path-to-regexp.service.mjs +238 -238
  147. package/esm2022/other/resize.mjs +3 -3
  148. package/esm2022/pipes/currency/cny.pipe.mjs +22 -22
  149. package/esm2022/pipes/currency/index.mjs +4 -4
  150. package/esm2022/pipes/currency/mega.pipe.mjs +24 -24
  151. package/esm2022/pipes/currency/module.mjs +18 -18
  152. package/esm2022/pipes/currency/pipe-currency.mjs +4 -4
  153. package/esm2022/pipes/currency/price.pipe.mjs +26 -26
  154. package/esm2022/pipes/filter/filter.pipe.mjs +19 -19
  155. package/esm2022/pipes/filter/index.mjs +2 -2
  156. package/esm2022/pipes/filter/module.mjs +16 -16
  157. package/esm2022/pipes/filter/pipe-filter.mjs +4 -4
  158. package/esm2022/pipes/format/index.mjs +2 -2
  159. package/esm2022/pipes/format/mask.pipe.mjs +33 -33
  160. package/esm2022/pipes/format/module.mjs +16 -16
  161. package/esm2022/pipes/format/pipe-format.mjs +4 -4
  162. package/esm2022/pipes/index.mjs +3 -3
  163. package/esm2022/pipes/pipes.mjs +4 -4
  164. package/esm2022/token/index.mjs +2 -2
  165. package/esm2022/token/page-visibility.mjs +14 -14
  166. package/esm2022/token/token.mjs +4 -4
  167. package/esm2022/token/window.mjs +16 -16
  168. package/esm2022/yelon-util.mjs +4 -4
  169. package/fesm2022/array.mjs +285 -285
  170. package/fesm2022/browser.mjs +273 -273
  171. package/fesm2022/config.mjs +58 -58
  172. package/fesm2022/config.mjs.map +1 -1
  173. package/fesm2022/date-time.mjs +223 -223
  174. package/fesm2022/decorator.mjs +129 -129
  175. package/fesm2022/form.mjs +118 -118
  176. package/fesm2022/format.mjs +426 -426
  177. package/fesm2022/math.mjs +85 -85
  178. package/fesm2022/mcache.mjs +65 -65
  179. package/fesm2022/mtypes.mjs +57 -57
  180. package/fesm2022/other.mjs +583 -583
  181. package/fesm2022/pipe-currency.mjs +90 -90
  182. package/fesm2022/pipe-filter.mjs +41 -41
  183. package/fesm2022/pipe-format.mjs +55 -55
  184. package/fesm2022/pipes.mjs +8 -8
  185. package/fesm2022/token.mjs +37 -37
  186. package/fesm2022/yelon-util.mjs +18 -18
  187. package/form/index.d.ts +2 -2
  188. package/form/match-control.d.ts +15 -15
  189. package/form/validators.d.ts +62 -62
  190. package/format/currency.service.d.ts +38 -38
  191. package/format/currency.types.d.ts +82 -82
  192. package/format/index.d.ts +4 -4
  193. package/format/string.d.ts +44 -44
  194. package/format/validate.d.ts +72 -72
  195. package/index.d.ts +13 -13
  196. package/math/in-range.d.ts +14 -14
  197. package/math/index.d.ts +2 -2
  198. package/math/round.d.ts +33 -33
  199. package/mcache/index.d.ts +1 -1
  200. package/mcache/localStorageUtils.d.ts +18 -18
  201. package/mtypes/authority.type.d.ts +3 -3
  202. package/mtypes/header-menu.type.d.ts +13 -13
  203. package/mtypes/index.d.ts +9 -9
  204. package/mtypes/menu.type.d.ts +41 -41
  205. package/mtypes/nav.types.d.ts +29 -29
  206. package/mtypes/page.d.ts +47 -47
  207. package/mtypes/project-info.types.d.ts +22 -22
  208. package/mtypes/response.d.ts +7 -7
  209. package/mtypes/role.type.d.ts +10 -10
  210. package/mtypes/user.types.d.ts +22 -22
  211. package/other/assert.d.ts +36 -36
  212. package/other/deep.d.ts +35 -35
  213. package/other/favicon.d.ts +2 -2
  214. package/other/index.d.ts +7 -7
  215. package/other/lazy.service.d.ts +47 -47
  216. package/other/logger.d.ts +5 -5
  217. package/other/path-to-regexp.service.d.ts +27 -27
  218. package/other/resize.d.ts +1 -1
  219. package/package.json +135 -135
  220. package/pipes/currency/cny.pipe.d.ts +14 -14
  221. package/pipes/currency/index.d.ts +4 -4
  222. package/pipes/currency/mega.pipe.d.ts +15 -15
  223. package/pipes/currency/module.d.ts +9 -9
  224. package/pipes/currency/price.pipe.d.ts +18 -18
  225. package/pipes/filter/filter.pipe.d.ts +13 -13
  226. package/pipes/filter/index.d.ts +2 -2
  227. package/pipes/filter/module.d.ts +7 -7
  228. package/pipes/format/index.d.ts +2 -2
  229. package/pipes/format/mask.pipe.d.ts +27 -27
  230. package/pipes/format/module.d.ts +7 -7
  231. package/pipes/index.d.ts +3 -3
  232. package/token/index.d.ts +2 -2
  233. package/token/page-visibility.d.ts +8 -8
  234. package/token/window.d.ts +7 -7
  235. package/config/abc/qr.type.d.ts +0 -25
  236. package/esm2022/config/abc/qr.type.mjs +0 -2
@@ -1,85 +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
- }
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
85
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5nLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9mb3JtYXQvc3RyaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQztBQUc1Qzs7Ozs7Ozs7OztHQVVHO0FBQ0gsTUFBTSxVQUFVLE1BQU0sQ0FDcEIsR0FBOEIsRUFDOUIsR0FBaUMsRUFDakMsY0FBdUIsS0FBSztJQUU1QixPQUFPLENBQUMsR0FBRyxJQUFJLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxjQUFjLEVBQUUsQ0FBQyxLQUFhLEVBQUUsR0FBVyxFQUFFLEVBQUUsQ0FDeEUsV0FBVyxDQUFDLENBQUMsQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLEdBQUcsQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsR0FBRyxJQUFJLEVBQUUsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxJQUFJLEVBQUUsQ0FDeEUsQ0FBQztBQUNKLENBQUM7QUFhRDs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBa0JHO0FBQ0gsTUFBTSxVQUFVLFVBQVUsQ0FBQyxLQUFhLEVBQUUsTUFBaUM7SUFDekUsSUFBSSxDQUFDLEtBQUssRUFBRSxDQUFDO1FBQ1gsT0FBTyxFQUFFLENBQUM7SUFDWixDQUFDO0lBQ0QsTUFBTSxHQUFHLEdBQXFCO1FBQzVCLEdB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\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,4}|:)|(?:[a-fA-F\\d]{1,4}:){2}(?:(?::[a-fA-F\\d]{1,4}){0,3}:(?: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,5}|:)|(?:[a-fA-F\\d]{1,4}:){1}(?:(?::[a-fA-F\\d]{1,4}){0,4}:(?: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+))(?:[eE]([-+]?\\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
+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|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
+ }
94
94
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Zvcm1hdC92YWxpZGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQUMsTUFBTSxTQUFTLEdBQUc7SUFDdkIsR0FBRyxFQUFFLHFFQUFxRTtJQUMxRSxNQUFNLEVBQUUsb0NBQW9DO0lBQzVDLE1BQU0sRUFBRSwrQkFBK0I7SUFDdkMsR0FBRyxFQUFFLG9MQUFvTDtJQUN6TCxFQUFFLEVBQUUsdzBDQUF3MEM7SUFDNTBDLEtBQUssRUFBRSxtRUFBbUU7SUFDMUUsT0FBTyxFQUFFLGtCQUFrQjtDQUM1QixDQUFDO0FBRUYsU0FBUyxRQUFRLENBQUMsR0FBVyxFQUFFLEtBQWM7SUFDM0MsT0FBTyxJQUFJLE1BQU0sQ0FBQyxJQUFJLEdBQUcsR0FBRyxFQUFFLEtBQUssQ0FBQyxDQUFDO0FBQ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AqIOaYr+WQpuS4uuaJi+acuuWPt++8iOS4reWbve+8iVxuICovXG5leHBvcnQgZnVuY3Rpb24gaXNNb2JpbGUodmFsdWU6IHN0cmluZyk6IGJvb2xlYW4ge1xuICByZXR1cm4gUkVHRVgubW9iaWxlLnRlc3QodmFsdWUpO1xufVxuXG4vKipcbiAqIFdoZXRlciBpcyB1cmwgYWRkcmVzc1xuICpcbiAqIOaYr+WQplVSTOWcsOWdgFxuICovXG5leHBvcnQgZnVuY3Rpb24gaXNVcmwodXJsOiBzdHJpbmcpOiBib29sZWFuIHtcbiAgcmV0dXJuIFJFR0VYLnVybC50ZXN0KHVybCk7XG59XG5cbi8qKlxuICogV2hldGVyIGlzIElQdjQgYWRkcmVzcyAoU3VwcG9ydCB2NCwgdjYpXG4gKlxuICog5piv5ZCmSVA05Zyw5Z2A77yI5pSv5oyBdjTjgIF2Nu+8iVxuICovXG5leHBvcnQgZnVuY3Rpb24gaXNJcChpcDogc3RyaW5nKTogYm9vbGVhbiB7XG4gIHJldHVybiBSRUdFWC5pcC50ZXN0KGlwKTtcbn1cblxuLyoqXG4gKiBXaGV0ZXIgaXMgY29sb3JcbiAqXG4gKiDmmK/lkKbpopzoibLku6PnoIHlgLxcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGlzQ29sb3IoY29sb3I6IHN0cmluZyk6IGJvb2xlYW4ge1xuICByZXR1cm4gUkVHRVguY29sb3IudGVzdChjb2xvcik7XG59XG5cbi8qKlxuICogV2hldGVyIGlzIGNoaW5lc2VcbiAqXG4gKiDmmK/lkKbkuK3mlodcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGlzQ2hpbmVzZSh2YWx1ZTogc3RyaW5nKTogYm9vbGVhbiB7XG4gIHJldHVybiBSRUdFWC5jaGluZXNlLnRlc3QodmFsdWUpO1xufVxuIl19
package/esm2022/index.mjs CHANGED
@@ -1,14 +1,14 @@
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
- export * from '@yelon/util/mtypes';
13
- export * from '@yelon/util/mcache';
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
+ export * from '@yelon/util/mtypes';
13
+ export * from '@yelon/util/mcache';
14
14
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyxxQkFBcUIsQ0FBQztBQUNwQyxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYyxrQkFBa0IsQ0FBQztBQUNqQyxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsa0JBQWtCLENBQUM7QUFDakMsY0FBYyx1QkFBdUIsQ0FBQztBQUN0QyxjQUFjLG1CQUFtQixDQUFDO0FBQ2xDLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyxtQkFBbUIsQ0FBQztBQUNsQyxjQUFjLG9CQUFvQixDQUFDO0FBQ25DLGNBQWMsb0JBQW9CLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICdAeWVsb24vdXRpbC9hcnJheSc7XG5leHBvcnQgKiBmcm9tICdAeWVsb24vdXRpbC9icm93c2VyJztcbmV4cG9ydCAqIGZyb20gJ0B5ZWxvbi91dGlsL2NvbmZpZyc7XG5leHBvcnQgKiBmcm9tICdAeWVsb24vdXRpbC9kYXRlLXRpbWUnO1xuZXhwb3J0ICogZnJvbSAnQHllbG9uL3V0aWwvZm9ybSc7XG5leHBvcnQgKiBmcm9tICdAeWVsb24vdXRpbC9mb3JtYXQnO1xuZXhwb3J0ICogZnJvbSAnQHllbG9uL3V0aWwvbWF0aCc7XG5leHBvcnQgKiBmcm9tICdAeWVsb24vdXRpbC9kZWNvcmF0b3InO1xuZXhwb3J0ICogZnJvbSAnQHllbG9uL3V0aWwvb3RoZXInO1xuZXhwb3J0ICogZnJvbSAnQHllbG9uL3V0aWwvcGlwZXMnO1xuZXhwb3J0ICogZnJvbSAnQHllbG9uL3V0aWwvdG9rZW4nO1xuZXhwb3J0ICogZnJvbSAnQHllbG9uL3V0aWwvbXR5cGVzJztcbmV4cG9ydCAqIGZyb20gJ0B5ZWxvbi91dGlsL21jYWNoZSc7XG4iXX0=
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW4tcmFuZ2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL21hdGgvaW4tcmFuZ2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBRWpEOzs7Ozs7Ozs7Ozs7R0FZRztBQUNILE1BQU0sVUFBVSxPQUFPLENBQUMsS0FBYSxFQUFFLEtBQWEsRUFBRSxHQUFZO0lBQ2hFLElBQUksR0FBRyxLQUFLLFNBQVMsRUFBRSxDQUFDO1FBQ3RCLEdBQUcsR0FBRyxLQUFLLENBQUM7UUFDWixLQUFLLEdBQUcsQ0FBQyxDQUFDO0lBQ1osQ0FBQztJQUNELFlBQVksQ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ZVxuICogaW5SYW5nZSg0LCA4KTsgLy8gdHJ1ZVxuICogaW5SYW5nZSg0LCAyKTsgLy8gZmFsc2VcbiAqIGluUmFuZ2UoMiwgMik7IC8vIGZhbHNlXG4gKiBpblJhbmdlKDEuMiwgMik7IC8vIHRydWVcbiAqIGluUmFuZ2UoLTMsIC0yLCAtNik7IC8vIHRydWVcbiAqIGBgYFxuICovXG5leHBvcnQgZnVuY3Rpb24gaW5SYW5nZSh2YWx1ZTogbnVtYmVyLCBzdGFydDogbnVtYmVyLCBlbmQ/OiBudW1iZXIpOiBib29sZWFuIHtcbiAgaWYgKGVuZCA9PT0gdW5kZWZpbmVkKSB7XG4gICAgZW5kID0gc3RhcnQ7XG4gICAgc3RhcnQgPSAwO1xuICB9XG4gIGFzc2VydE51bWJlcih2YWx1ZSk7XG4gIGFzc2VydE51bWJlcihzdGFydCk7XG4gIGFzc2VydE51bWJlcihlbmQpO1xuICByZXR1cm4gdmFsdWUgPj0gTWF0aC5taW4oc3RhcnQsIGVuZCkgJiYgdmFsdWUgPCBNYXRoLm1heChzdGFydCwgZW5kKTtcbn1cbiJdfQ==
@@ -1,3 +1,3 @@
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
@@ -1,5 +1,5 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './index';
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './index';
5
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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ROYW1lXSBhcyAoeDogbnVtYmVyKSA9PiBudW1iZXI7XG5cbiAgcHJlY2lzaW9uID0gcHJlY2lzaW9uID09IG51bGwgPyAwIDogTWF0aC5taW4ocHJlY2lzaW9uLCAyOTIpO1xuICBpZiAoIXByZWNpc2lvbikge1xuICAgIHJldHVybiBmdW5jKG51bWJlcik7XG4gIH1cbiAgLy8gU2hpZnQgd2l0aCBleHBvbmVudGlhbCBub3RhdGlvbiB0byBhdm9pZCBmbG9hdGluZy1wb2ludCBpc3N1ZXMuXG4gIC8vIFNlZSBbTUROXShodHRwczovL21kbi5pby9yb3VuZCNFeGFtcGxlcykgZm9yIG1vcmUgZGV0YWlscy5cbiAgbGV0IHBhaXIgPSBgJHtudW1iZXJ9ZWAuc3BsaXQoJ2UnKTtcbiAgY29uc3QgdmFsdWUgPSBmdW5jKE51bWJlcihgJHtwYWlyWzBdfWUke051bWJlcihwYWlyWzFdKSArIHByZWNpc2lvbn1gKSk7XG4gIHBhaXIgPSBgJHt2YWx1ZX1lYC5zcGxpdCgnZScpO1xuICByZXR1cm4gTnVtYmVyKGAke3BhaXJbMF19ZSR7TnVtYmVyKHBhaXJbMV0pIC0gcHJlY2lzaW9ufWApO1xufVxuIl19
@@ -1,2 +1,2 @@
1
- export * from './localStorageUtils';
1
+ export * from './localStorageUtils';
2
2
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL21jYWNoZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHFCQUFxQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9sb2NhbFN0b3JhZ2VVdGlscyc7XG4iXX0=