@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.
- package/case-name/index.js +23 -0
- package/class-name/index.js +9 -0
- package/clipboard-copy/index.js +41 -0
- package/constant/address.js +5304 -0
- package/constant/chineseCharacters.js +4 -0
- package/constant/constellations.js +17 -0
- package/constant/domain.js +268 -0
- package/constant/identity.js +18 -0
- package/constant/index.js +6 -0
- package/constant/keyboardCode.js +105 -0
- package/constant/licensePlate.js +42 -0
- package/constant/name.js +666 -0
- package/constant/platform.js +20 -0
- package/constant/protocol.js +18 -0
- package/constant/ui.js +17 -0
- package/cookie/index.js +33 -0
- package/cookie/src/index.js +116 -0
- package/decimal/decimal.js +1070 -0
- package/decimal/index.js +5 -0
- package/event-emitter/index.js +57 -0
- package/file/fileToURL.js +26 -0
- package/file/index.js +6 -0
- package/file/saveAs.js +35 -0
- package/filesize/index.js +8 -0
- package/filesize/src/constants.js +71 -0
- package/filesize/src/filesize.js +88 -0
- package/index.js +47 -0
- package/invariant/index.js +21 -0
- package/is/index.js +137 -0
- package/math/index.js +34 -0
- package/md5/index.js +65 -0
- package/mock/MockWebSocket.js +117 -0
- package/mock/MockXMLHttpRequest.js +94 -0
- package/mock/index.js +8 -0
- package/normalize-wheel/ExecutionEnvironment.js +11 -0
- package/normalize-wheel/UserAgent_DEPRECATED.js +146 -0
- package/normalize-wheel/index.js +13 -0
- package/normalize-wheel/isEventSupported.js +33 -0
- package/nzh/cn.js +7 -0
- package/nzh/hk.js +7 -0
- package/nzh/index.js +4 -0
- package/nzh/nzh.js +22 -0
- package/nzh/src/autoGet.js +25 -0
- package/nzh/src/index.js +93 -0
- package/nzh/src/langs/cn_b.js +12 -0
- package/nzh/src/langs/cn_s.js +9 -0
- package/nzh/src/langs/hk_b.js +12 -0
- package/nzh/src/langs/hk_s.js +9 -0
- package/nzh/src/utils.js +71 -0
- package/objectKeysSort.js +7 -0
- package/package.json +1 -0
- package/random/address.js +32 -0
- package/random/constellation.js +8 -0
- package/random/image.js +20 -0
- package/random/index.js +63 -0
- package/random/licensePlate.js +12 -0
- package/random/name.js +25 -0
- package/random/number.js +15 -0
- package/random/text.js +117 -0
- package/random/time.js +8 -0
- package/random/web.js +37 -0
- package/screenfull/index.js +119 -0
- package/tree/index.js +87 -0
- package/turbo-stream/index.js +6 -0
- package/turbo-stream/src/decode.js +284 -0
- package/turbo-stream/src/encode.js +363 -0
- package/turbo-stream/src/shared.js +287 -0
- package/url-toolkit/index.js +8 -0
- 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
|
+
};
|