@unicom-cloud/utils 0.1.1

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 (69) hide show
  1. package/case-name/index.js +23 -0
  2. package/class-name/index.js +9 -0
  3. package/clipboard-copy/index.js +41 -0
  4. package/constant/address.js +5304 -0
  5. package/constant/chineseCharacters.js +4 -0
  6. package/constant/constellations.js +17 -0
  7. package/constant/domain.js +268 -0
  8. package/constant/identity.js +18 -0
  9. package/constant/index.js +6 -0
  10. package/constant/keyboardCode.js +105 -0
  11. package/constant/licensePlate.js +42 -0
  12. package/constant/name.js +666 -0
  13. package/constant/platform.js +20 -0
  14. package/constant/protocol.js +18 -0
  15. package/constant/ui.js +17 -0
  16. package/cookie/index.js +33 -0
  17. package/cookie/src/index.js +116 -0
  18. package/decimal/decimal.js +1070 -0
  19. package/decimal/index.js +5 -0
  20. package/event-emitter/index.js +57 -0
  21. package/file/fileToURL.js +26 -0
  22. package/file/index.js +6 -0
  23. package/file/saveAs.js +35 -0
  24. package/filesize/index.js +8 -0
  25. package/filesize/src/constants.js +71 -0
  26. package/filesize/src/filesize.js +88 -0
  27. package/index.js +47 -0
  28. package/invariant/index.js +21 -0
  29. package/is/index.js +137 -0
  30. package/math/index.js +34 -0
  31. package/md5/index.js +65 -0
  32. package/mock/MockWebSocket.js +117 -0
  33. package/mock/MockXMLHttpRequest.js +94 -0
  34. package/mock/index.js +8 -0
  35. package/normalize-wheel/ExecutionEnvironment.js +11 -0
  36. package/normalize-wheel/UserAgent_DEPRECATED.js +146 -0
  37. package/normalize-wheel/index.js +13 -0
  38. package/normalize-wheel/isEventSupported.js +33 -0
  39. package/nzh/cn.js +7 -0
  40. package/nzh/hk.js +7 -0
  41. package/nzh/index.js +4 -0
  42. package/nzh/nzh.js +22 -0
  43. package/nzh/src/autoGet.js +25 -0
  44. package/nzh/src/index.js +93 -0
  45. package/nzh/src/langs/cn_b.js +12 -0
  46. package/nzh/src/langs/cn_s.js +9 -0
  47. package/nzh/src/langs/hk_b.js +12 -0
  48. package/nzh/src/langs/hk_s.js +9 -0
  49. package/nzh/src/utils.js +71 -0
  50. package/objectKeysSort.js +7 -0
  51. package/package.json +1 -0
  52. package/random/address.js +32 -0
  53. package/random/constellation.js +8 -0
  54. package/random/image.js +20 -0
  55. package/random/index.js +63 -0
  56. package/random/licensePlate.js +12 -0
  57. package/random/name.js +25 -0
  58. package/random/number.js +15 -0
  59. package/random/text.js +117 -0
  60. package/random/time.js +8 -0
  61. package/random/web.js +37 -0
  62. package/screenfull/index.js +119 -0
  63. package/tree/index.js +87 -0
  64. package/turbo-stream/index.js +6 -0
  65. package/turbo-stream/src/decode.js +284 -0
  66. package/turbo-stream/src/encode.js +363 -0
  67. package/turbo-stream/src/shared.js +287 -0
  68. package/url-toolkit/index.js +8 -0
  69. package/url-toolkit/src/url-toolkit.js +74 -0
@@ -0,0 +1,23 @@
1
+ import C from "lodash/camelCase";
2
+ import f from "lodash/capitalize";
3
+ import n from "lodash/kebabCase";
4
+ import N from "lodash/lowerFirst";
5
+ import l from "lodash/snakeCase";
6
+ import u from "lodash/startCase";
7
+ import a from "lodash/upperFirst";
8
+ function g(e) {
9
+ const s = n(e), o = l(e), t = C(e), r = f(e), m = u(e), i = N(e), p = a(e), c = a(t);
10
+ return {
11
+ kebabCaseName: s,
12
+ snakeCaseName: o,
13
+ camelCaseName: t,
14
+ capitalizeName: r,
15
+ startCaseName: m,
16
+ lowerFirstCaseName: i,
17
+ upperFirstCaseName: p,
18
+ ComponentCaseName: c
19
+ };
20
+ }
21
+ export {
22
+ g as default
23
+ };
@@ -0,0 +1,9 @@
1
+ import r from "lodash/isPlainObject";
2
+ import a from "lodash/uniq";
3
+ function m(...n) {
4
+ const i = " ", e = n.map((t, f, l) => r(t) ? Object.keys(t).filter((o) => t[o]) : t).flat(1 / 0).filter(Boolean).join(i).split(i).filter(Boolean);
5
+ return a(e).join(i);
6
+ }
7
+ export {
8
+ m as default
9
+ };
@@ -0,0 +1,41 @@
1
+ import "../is/index.js";
2
+ import r from "lodash/isString";
3
+ function n() {
4
+ return new DOMException("The request is not allowed", "NotAllowedError");
5
+ }
6
+ async function i(e) {
7
+ if (!navigator.clipboard)
8
+ throw n();
9
+ return navigator.clipboard.writeText(e);
10
+ }
11
+ async function l(e) {
12
+ const o = document.createElement("span");
13
+ o.textContent = e, o.style.whiteSpace = "pre", o.style.webkitUserSelect = "auto", o.style.userSelect = "all", document.body.appendChild(o);
14
+ const t = window.getSelection(), a = window.document.createRange();
15
+ t.removeAllRanges(), a.selectNode(o), t.addRange(a);
16
+ let c = !1;
17
+ try {
18
+ c = window.document.execCommand("copy");
19
+ } finally {
20
+ t.removeAllRanges(), window.document.body.removeChild(o);
21
+ }
22
+ if (!c) throw n();
23
+ }
24
+ async function p(e) {
25
+ try {
26
+ r(e) || (e = JSON.stringify(e) ?? e);
27
+ } catch {
28
+ }
29
+ try {
30
+ await i(e);
31
+ } catch (o) {
32
+ try {
33
+ await l(e);
34
+ } catch (t) {
35
+ throw t || o || n();
36
+ }
37
+ }
38
+ }
39
+ export {
40
+ p as default
41
+ };