@wener/utils 1.0.0 → 1.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/README.md +5 -3
- package/jest.config.js +7 -5
- package/lib/cjs/arrays/MaybeArray.js +45 -33
- package/lib/cjs/arrays/index.js +17 -5
- package/lib/cjs/asyncs/AsyncInterval.js +32 -25
- package/lib/cjs/asyncs/LazyPromise.js +41 -24
- package/lib/cjs/asyncs/MaybePromise.js +15 -3
- package/lib/cjs/asyncs/generatorOfStream.js +33 -28
- package/lib/cjs/asyncs/index.js +23 -11
- package/lib/cjs/asyncs/isPromise.js +23 -6
- package/lib/cjs/asyncs/promiseOfCallback.js +34 -19
- package/lib/cjs/asyncs/sleep.js +23 -5
- package/lib/cjs/asyncs/timeout.js +42 -28
- package/lib/cjs/browsers/copy.js +71 -0
- package/lib/cjs/browsers/download.js +44 -33
- package/lib/cjs/browsers/getFileFromDataTransfer.js +48 -0
- package/lib/cjs/browsers/index.js +20 -8
- package/lib/cjs/browsers/loaders.js +48 -35
- package/lib/cjs/formats/formatBytes.js +36 -0
- package/lib/cjs/index.js +35 -13
- package/lib/cjs/io/index.js +17 -5
- package/lib/cjs/io/isBuffer.js +23 -10
- package/lib/cjs/isomorphics/getGlobalThis.js +32 -27
- package/lib/cjs/maths/index.js +17 -5
- package/lib/cjs/maths/random.js +34 -19
- package/lib/cjs/shim/urljoin.js +70 -0
- package/lib/cjs/shim/urljoin.test.js +4 -0
- package/lib/cjs/strings/camelCase.js +70 -68
- package/lib/cjs/strings/index.js +18 -7
- package/lib/cjs/strings/templates.js +26 -18
- package/lib/cjs/validations/asserts.js +25 -14
- package/lib/cjs/validations/index.js +20 -8
- package/lib/cjs/validations/isClass.js +23 -6
- package/lib/cjs/validations/isDefined.js +23 -6
- package/lib/cjs/validations/isEmptyObject.js +26 -9
- package/lib/esm/arrays/MaybeArray.js +29 -29
- package/lib/esm/arrays/index.js +1 -2
- package/lib/esm/asyncs/AsyncInterval.js +14 -21
- package/lib/esm/asyncs/LazyPromise.js +23 -21
- package/lib/esm/asyncs/MaybePromise.js +0 -1
- package/lib/esm/asyncs/generatorOfStream.js +14 -24
- package/lib/esm/asyncs/index.js +7 -8
- package/lib/esm/asyncs/isPromise.js +5 -3
- package/lib/esm/asyncs/promiseOfCallback.js +16 -16
- package/lib/esm/asyncs/sleep.js +4 -2
- package/lib/esm/asyncs/timeout.js +24 -25
- package/lib/{cjs/browsers/clipboard.d.ts → esm/browsers/copy.d.ts} +0 -0
- package/lib/esm/browsers/copy.js +52 -0
- package/lib/esm/browsers/download.js +25 -29
- package/lib/esm/browsers/getFileFromDataTransfer.d.ts +4 -0
- package/lib/esm/browsers/getFileFromDataTransfer.js +29 -0
- package/lib/esm/browsers/index.d.ts +2 -2
- package/lib/esm/browsers/index.js +4 -5
- package/lib/esm/browsers/loaders.js +31 -32
- package/lib/esm/formats/formatBytes.d.ts +11 -0
- package/lib/esm/formats/formatBytes.js +17 -0
- package/lib/esm/index.d.ts +3 -2
- package/lib/esm/index.js +15 -10
- package/lib/esm/io/index.js +1 -2
- package/lib/esm/io/isBuffer.js +5 -7
- package/lib/esm/isomorphics/getGlobalThis.d.ts +1 -1
- package/lib/esm/isomorphics/getGlobalThis.js +13 -24
- package/lib/esm/maths/index.js +1 -2
- package/lib/esm/maths/random.d.ts +2 -2
- package/lib/esm/maths/random.js +15 -15
- package/lib/{cjs/strings → esm/shim}/urljoin.d.ts +1 -0
- package/lib/esm/shim/urljoin.js +51 -0
- package/lib/{cjs/strings → esm/shim}/urljoin.test.d.ts +0 -0
- package/lib/esm/shim/urljoin.test.js +4 -0
- package/lib/esm/strings/camelCase.js +52 -64
- package/lib/esm/strings/index.d.ts +0 -1
- package/lib/esm/strings/index.js +2 -4
- package/lib/esm/strings/templates.d.ts +1 -1
- package/lib/esm/strings/templates.js +7 -14
- package/lib/esm/validations/asserts.js +8 -11
- package/lib/esm/validations/index.js +4 -5
- package/lib/esm/validations/isClass.js +5 -3
- package/lib/esm/validations/isDefined.js +5 -3
- package/lib/esm/validations/isEmptyObject.js +8 -6
- package/package.json +23 -32
- package/src/arrays/MaybeArray.ts +5 -2
- package/src/asyncs/timeout.ts +1 -1
- package/src/browsers/{clipboard.ts → copy.ts} +0 -0
- package/src/browsers/{transfers.ts → getFileFromDataTransfer.ts} +12 -7
- package/src/browsers/index.ts +2 -2
- package/src/browsers/loaders.ts +1 -1
- package/src/formats/formatBytes.ts +30 -0
- package/src/index.ts +4 -2
- package/src/isomorphics/getGlobalThis.ts +2 -4
- package/src/maths/random.ts +5 -5
- package/src/shim/urljoin.test.ts +5 -0
- package/src/{strings → shim}/urljoin.ts +18 -5
- package/src/strings/index.ts +0 -1
- package/src/strings/templates.ts +2 -4
- package/tsconfig.json +15 -4
- package/dist/wener-utils.cjs +0 -882
- package/dist/wener-utils.cjs.map +0 -1
- package/dist/wener-utils.esm.js +0 -849
- package/dist/wener-utils.esm.js.map +0 -1
- package/dist/wener-utils.system.js +0 -887
- package/dist/wener-utils.system.js.map +0 -1
- package/dist/wener-utils.umd.js +0 -886
- package/dist/wener-utils.umd.js.map +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -10
- package/lib/cjs/arrays/MaybeArray.d.ts +0 -5
- package/lib/cjs/arrays/MaybeArray.js.map +0 -1
- package/lib/cjs/arrays/index.d.ts +0 -1
- package/lib/cjs/arrays/index.js.map +0 -1
- package/lib/cjs/asyncs/AsyncInterval.d.ts +0 -3
- package/lib/cjs/asyncs/AsyncInterval.js.map +0 -1
- package/lib/cjs/asyncs/LazyPromise.d.ts +0 -5
- package/lib/cjs/asyncs/LazyPromise.js.map +0 -1
- package/lib/cjs/asyncs/MaybePromise.d.ts +0 -1
- package/lib/cjs/asyncs/MaybePromise.js.map +0 -1
- package/lib/cjs/asyncs/generatorOfStream.d.ts +0 -1
- package/lib/cjs/asyncs/generatorOfStream.js.map +0 -1
- package/lib/cjs/asyncs/index.d.ts +0 -7
- package/lib/cjs/asyncs/index.js.map +0 -1
- package/lib/cjs/asyncs/isPromise.d.ts +0 -1
- package/lib/cjs/asyncs/isPromise.js.map +0 -1
- package/lib/cjs/asyncs/promiseOfCallback.d.ts +0 -1
- package/lib/cjs/asyncs/promiseOfCallback.js.map +0 -1
- package/lib/cjs/asyncs/sleep.d.ts +0 -1
- package/lib/cjs/asyncs/sleep.js.map +0 -1
- package/lib/cjs/asyncs/timeout.d.ts +0 -4
- package/lib/cjs/asyncs/timeout.js.map +0 -1
- package/lib/cjs/browsers/clipboard.js +0 -56
- package/lib/cjs/browsers/clipboard.js.map +0 -1
- package/lib/cjs/browsers/download.d.ts +0 -4
- package/lib/cjs/browsers/download.js.map +0 -1
- package/lib/cjs/browsers/index.d.ts +0 -4
- package/lib/cjs/browsers/index.js.map +0 -1
- package/lib/cjs/browsers/loaders.d.ts +0 -6
- package/lib/cjs/browsers/loaders.js.map +0 -1
- package/lib/cjs/browsers/transfers.d.ts +0 -4
- package/lib/cjs/browsers/transfers.js +0 -38
- package/lib/cjs/browsers/transfers.js.map +0 -1
- package/lib/cjs/envs/index.d.ts +0 -1
- package/lib/cjs/envs/index.js +0 -5
- package/lib/cjs/envs/index.js.map +0 -1
- package/lib/cjs/envs/isDev.d.ts +0 -1
- package/lib/cjs/envs/isDev.js +0 -8
- package/lib/cjs/envs/isDev.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -9
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/io/index.d.ts +0 -1
- package/lib/cjs/io/index.js.map +0 -1
- package/lib/cjs/io/isBuffer.d.ts +0 -2
- package/lib/cjs/io/isBuffer.js.map +0 -1
- package/lib/cjs/isomorphics/getGlobalThis.d.ts +0 -9
- package/lib/cjs/isomorphics/getGlobalThis.js.map +0 -1
- package/lib/cjs/isomorphics/index.d.ts +0 -1
- package/lib/cjs/isomorphics/index.js +0 -5
- package/lib/cjs/isomorphics/index.js.map +0 -1
- package/lib/cjs/maths/index.d.ts +0 -1
- package/lib/cjs/maths/index.js.map +0 -1
- package/lib/cjs/maths/random.d.ts +0 -3
- package/lib/cjs/maths/random.js.map +0 -1
- package/lib/cjs/strings/camelCase.d.ts +0 -4
- package/lib/cjs/strings/camelCase.js.map +0 -1
- package/lib/cjs/strings/index.d.ts +0 -3
- package/lib/cjs/strings/index.js.map +0 -1
- package/lib/cjs/strings/templates.d.ts +0 -7
- package/lib/cjs/strings/templates.js.map +0 -1
- package/lib/cjs/strings/urljoin.js +0 -61
- package/lib/cjs/strings/urljoin.js.map +0 -1
- package/lib/cjs/strings/urljoin.test.js +0 -7
- package/lib/cjs/strings/urljoin.test.js.map +0 -1
- package/lib/cjs/validations/asserts.d.ts +0 -2
- package/lib/cjs/validations/asserts.js.map +0 -1
- package/lib/cjs/validations/index.d.ts +0 -4
- package/lib/cjs/validations/index.js.map +0 -1
- package/lib/cjs/validations/isClass.d.ts +0 -1
- package/lib/cjs/validations/isClass.js.map +0 -1
- package/lib/cjs/validations/isDefined.d.ts +0 -1
- package/lib/cjs/validations/isDefined.js.map +0 -1
- package/lib/cjs/validations/isEmptyObject.d.ts +0 -1
- package/lib/cjs/validations/isEmptyObject.js.map +0 -1
- package/lib/esm/arrays/MaybeArray.js.map +0 -1
- package/lib/esm/arrays/index.js.map +0 -1
- package/lib/esm/asyncs/AsyncInterval.js.map +0 -1
- package/lib/esm/asyncs/LazyPromise.js.map +0 -1
- package/lib/esm/asyncs/MaybePromise.js.map +0 -1
- package/lib/esm/asyncs/generatorOfStream.js.map +0 -1
- package/lib/esm/asyncs/index.js.map +0 -1
- package/lib/esm/asyncs/isPromise.js.map +0 -1
- package/lib/esm/asyncs/promiseOfCallback.js.map +0 -1
- package/lib/esm/asyncs/sleep.js.map +0 -1
- package/lib/esm/asyncs/timeout.js.map +0 -1
- package/lib/esm/browsers/clipboard.d.ts +0 -1
- package/lib/esm/browsers/clipboard.js +0 -52
- package/lib/esm/browsers/clipboard.js.map +0 -1
- package/lib/esm/browsers/download.js.map +0 -1
- package/lib/esm/browsers/index.js.map +0 -1
- package/lib/esm/browsers/loaders.js.map +0 -1
- package/lib/esm/browsers/transfers.d.ts +0 -4
- package/lib/esm/browsers/transfers.js +0 -34
- package/lib/esm/browsers/transfers.js.map +0 -1
- package/lib/esm/envs/index.d.ts +0 -1
- package/lib/esm/envs/index.js +0 -2
- package/lib/esm/envs/index.js.map +0 -1
- package/lib/esm/envs/isDev.d.ts +0 -1
- package/lib/esm/envs/isDev.js +0 -5
- package/lib/esm/envs/isDev.js.map +0 -1
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/io/index.js.map +0 -1
- package/lib/esm/io/isBuffer.js.map +0 -1
- package/lib/esm/isomorphics/getGlobalThis.js.map +0 -1
- package/lib/esm/isomorphics/index.d.ts +0 -1
- package/lib/esm/isomorphics/index.js +0 -2
- package/lib/esm/isomorphics/index.js.map +0 -1
- package/lib/esm/maths/index.js.map +0 -1
- package/lib/esm/maths/random.js.map +0 -1
- package/lib/esm/strings/camelCase.js.map +0 -1
- package/lib/esm/strings/index.js.map +0 -1
- package/lib/esm/strings/templates.js.map +0 -1
- package/lib/esm/strings/urljoin.d.ts +0 -1
- package/lib/esm/strings/urljoin.js +0 -57
- package/lib/esm/strings/urljoin.js.map +0 -1
- package/lib/esm/strings/urljoin.test.d.ts +0 -1
- package/lib/esm/strings/urljoin.test.js +0 -5
- package/lib/esm/strings/urljoin.test.js.map +0 -1
- package/lib/esm/validations/asserts.js.map +0 -1
- package/lib/esm/validations/index.js.map +0 -1
- package/lib/esm/validations/isClass.js.map +0 -1
- package/lib/esm/validations/isDefined.js.map +0 -1
- package/lib/esm/validations/isEmptyObject.js.map +0 -1
- package/lib/esnext/arrays/MaybeArray.d.ts +0 -5
- package/lib/esnext/arrays/MaybeArray.js +0 -33
- package/lib/esnext/arrays/MaybeArray.js.map +0 -1
- package/lib/esnext/arrays/index.d.ts +0 -1
- package/lib/esnext/arrays/index.js +0 -2
- package/lib/esnext/arrays/index.js.map +0 -1
- package/lib/esnext/asyncs/AsyncInterval.d.ts +0 -3
- package/lib/esnext/asyncs/AsyncInterval.js +0 -23
- package/lib/esnext/asyncs/AsyncInterval.js.map +0 -1
- package/lib/esnext/asyncs/LazyPromise.d.ts +0 -5
- package/lib/esnext/asyncs/LazyPromise.js +0 -22
- package/lib/esnext/asyncs/LazyPromise.js.map +0 -1
- package/lib/esnext/asyncs/MaybePromise.d.ts +0 -1
- package/lib/esnext/asyncs/MaybePromise.js +0 -1
- package/lib/esnext/asyncs/MaybePromise.js.map +0 -1
- package/lib/esnext/asyncs/generatorOfStream.d.ts +0 -1
- package/lib/esnext/asyncs/generatorOfStream.js +0 -26
- package/lib/esnext/asyncs/generatorOfStream.js.map +0 -1
- package/lib/esnext/asyncs/index.d.ts +0 -7
- package/lib/esnext/asyncs/index.js +0 -8
- package/lib/esnext/asyncs/index.js.map +0 -1
- package/lib/esnext/asyncs/isPromise.d.ts +0 -1
- package/lib/esnext/asyncs/isPromise.js +0 -4
- package/lib/esnext/asyncs/isPromise.js.map +0 -1
- package/lib/esnext/asyncs/promiseOfCallback.d.ts +0 -1
- package/lib/esnext/asyncs/promiseOfCallback.js +0 -18
- package/lib/esnext/asyncs/promiseOfCallback.js.map +0 -1
- package/lib/esnext/asyncs/sleep.d.ts +0 -1
- package/lib/esnext/asyncs/sleep.js +0 -2
- package/lib/esnext/asyncs/sleep.js.map +0 -1
- package/lib/esnext/asyncs/timeout.d.ts +0 -4
- package/lib/esnext/asyncs/timeout.js +0 -26
- package/lib/esnext/asyncs/timeout.js.map +0 -1
- package/lib/esnext/browsers/clipboard.d.ts +0 -1
- package/lib/esnext/browsers/clipboard.js +0 -52
- package/lib/esnext/browsers/clipboard.js.map +0 -1
- package/lib/esnext/browsers/download.d.ts +0 -4
- package/lib/esnext/browsers/download.js +0 -32
- package/lib/esnext/browsers/download.js.map +0 -1
- package/lib/esnext/browsers/index.d.ts +0 -4
- package/lib/esnext/browsers/index.js +0 -5
- package/lib/esnext/browsers/index.js.map +0 -1
- package/lib/esnext/browsers/loaders.d.ts +0 -6
- package/lib/esnext/browsers/loaders.js +0 -36
- package/lib/esnext/browsers/loaders.js.map +0 -1
- package/lib/esnext/browsers/transfers.d.ts +0 -4
- package/lib/esnext/browsers/transfers.js +0 -34
- package/lib/esnext/browsers/transfers.js.map +0 -1
- package/lib/esnext/envs/index.d.ts +0 -1
- package/lib/esnext/envs/index.js +0 -2
- package/lib/esnext/envs/index.js.map +0 -1
- package/lib/esnext/envs/isDev.d.ts +0 -1
- package/lib/esnext/envs/isDev.js +0 -5
- package/lib/esnext/envs/isDev.js.map +0 -1
- package/lib/esnext/index.d.ts +0 -9
- package/lib/esnext/index.js +0 -10
- package/lib/esnext/index.js.map +0 -1
- package/lib/esnext/io/index.d.ts +0 -1
- package/lib/esnext/io/index.js +0 -2
- package/lib/esnext/io/index.js.map +0 -1
- package/lib/esnext/io/isBuffer.d.ts +0 -2
- package/lib/esnext/io/isBuffer.js +0 -8
- package/lib/esnext/io/isBuffer.js.map +0 -1
- package/lib/esnext/isomorphics/getGlobalThis.d.ts +0 -9
- package/lib/esnext/isomorphics/getGlobalThis.js +0 -25
- package/lib/esnext/isomorphics/getGlobalThis.js.map +0 -1
- package/lib/esnext/isomorphics/index.d.ts +0 -1
- package/lib/esnext/isomorphics/index.js +0 -2
- package/lib/esnext/isomorphics/index.js.map +0 -1
- package/lib/esnext/maths/index.d.ts +0 -1
- package/lib/esnext/maths/index.js +0 -2
- package/lib/esnext/maths/index.js.map +0 -1
- package/lib/esnext/maths/random.d.ts +0 -3
- package/lib/esnext/maths/random.js +0 -17
- package/lib/esnext/maths/random.js.map +0 -1
- package/lib/esnext/strings/camelCase.d.ts +0 -4
- package/lib/esnext/strings/camelCase.js +0 -69
- package/lib/esnext/strings/camelCase.js.map +0 -1
- package/lib/esnext/strings/index.d.ts +0 -3
- package/lib/esnext/strings/index.js +0 -4
- package/lib/esnext/strings/index.js.map +0 -1
- package/lib/esnext/strings/templates.d.ts +0 -7
- package/lib/esnext/strings/templates.js +0 -15
- package/lib/esnext/strings/templates.js.map +0 -1
- package/lib/esnext/strings/urljoin.d.ts +0 -1
- package/lib/esnext/strings/urljoin.js +0 -57
- package/lib/esnext/strings/urljoin.js.map +0 -1
- package/lib/esnext/strings/urljoin.test.d.ts +0 -1
- package/lib/esnext/strings/urljoin.test.js +0 -5
- package/lib/esnext/strings/urljoin.test.js.map +0 -1
- package/lib/esnext/validations/asserts.d.ts +0 -2
- package/lib/esnext/validations/asserts.js +0 -13
- package/lib/esnext/validations/asserts.js.map +0 -1
- package/lib/esnext/validations/index.d.ts +0 -4
- package/lib/esnext/validations/index.js +0 -5
- package/lib/esnext/validations/index.js.map +0 -1
- package/lib/esnext/validations/isClass.d.ts +0 -1
- package/lib/esnext/validations/isClass.js +0 -4
- package/lib/esnext/validations/isClass.js.map +0 -1
- package/lib/esnext/validations/isDefined.d.ts +0 -1
- package/lib/esnext/validations/isDefined.js +0 -4
- package/lib/esnext/validations/isDefined.js.map +0 -1
- package/lib/esnext/validations/isEmptyObject.d.ts +0 -1
- package/lib/esnext/validations/isEmptyObject.js +0 -7
- package/lib/esnext/validations/isEmptyObject.js.map +0 -1
- package/rollup.config.ts +0 -85
- package/src/envs/index.ts +0 -1
- package/src/envs/isDev.ts +0 -3
- package/src/isomorphics/index.ts +0 -1
- package/src/strings/urljoin.test.ts +0 -5
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var copy_exports = {};
|
|
19
|
+
__export(copy_exports, {
|
|
20
|
+
copy: () => copy
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(copy_exports);
|
|
23
|
+
let _copy;
|
|
24
|
+
function initCopy() {
|
|
25
|
+
let textArea;
|
|
26
|
+
function isIOS() {
|
|
27
|
+
return navigator.userAgent.match(/ipad|iphone/i);
|
|
28
|
+
}
|
|
29
|
+
function createTextArea(text) {
|
|
30
|
+
textArea = document.createElement("textArea");
|
|
31
|
+
textArea.value = text;
|
|
32
|
+
document.body.appendChild(textArea);
|
|
33
|
+
}
|
|
34
|
+
function selectText() {
|
|
35
|
+
let range, selection;
|
|
36
|
+
if (isIOS()) {
|
|
37
|
+
range = document.createRange();
|
|
38
|
+
range.selectNodeContents(textArea);
|
|
39
|
+
selection = window.getSelection();
|
|
40
|
+
if (selection === null) {
|
|
41
|
+
console.error(`no selection`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
selection.removeAllRanges();
|
|
45
|
+
selection.addRange(range);
|
|
46
|
+
textArea.setSelectionRange(0, 999999);
|
|
47
|
+
} else {
|
|
48
|
+
textArea.select();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function copyToClipboard() {
|
|
52
|
+
document.execCommand("copy");
|
|
53
|
+
document.body.removeChild(textArea);
|
|
54
|
+
}
|
|
55
|
+
_copy = (text) => {
|
|
56
|
+
createTextArea(text);
|
|
57
|
+
selectText();
|
|
58
|
+
copyToClipboard();
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function copy(text) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
if ((_b = (_a = window.navigator) == null ? void 0 : _a.clipboard) == null ? void 0 : _b.writeText) {
|
|
64
|
+
window.navigator.clipboard.writeText(text);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (!_copy) {
|
|
68
|
+
initCopy();
|
|
69
|
+
}
|
|
70
|
+
_copy(text);
|
|
71
|
+
}
|
|
@@ -1,36 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var download_exports = {};
|
|
19
|
+
__export(download_exports, {
|
|
20
|
+
download: () => download
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(download_exports);
|
|
23
|
+
function download(filename, data, { type = "application/octet-stream", raw = false } = {}) {
|
|
24
|
+
const a = document.createElement("a");
|
|
25
|
+
let closer = () => null;
|
|
26
|
+
try {
|
|
27
|
+
a.download = filename;
|
|
28
|
+
if (typeof data === "string" && /^(https?:|data:)/.test(data) && !raw) {
|
|
29
|
+
a.href = data;
|
|
30
|
+
} else if (typeof data === "string") {
|
|
31
|
+
data = new TextEncoder().encode(data);
|
|
30
32
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
if (data instanceof Uint8Array) {
|
|
34
|
+
data = new Blob([data], { type });
|
|
33
35
|
}
|
|
36
|
+
if (data instanceof File || data instanceof Blob || data instanceof MediaSource) {
|
|
37
|
+
a.href = URL.createObjectURL(data);
|
|
38
|
+
closer = () => URL.revokeObjectURL(a.href);
|
|
39
|
+
} else {
|
|
40
|
+
console.error(`invalid download data`, data);
|
|
41
|
+
throw new Error(`can not download ${Object.getPrototypeOf(data)}`);
|
|
42
|
+
}
|
|
43
|
+
a.click();
|
|
44
|
+
} finally {
|
|
45
|
+
closer();
|
|
46
|
+
}
|
|
34
47
|
}
|
|
35
|
-
exports.download = download;
|
|
36
|
-
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var getFileFromDataTransfer_exports = {};
|
|
19
|
+
__export(getFileFromDataTransfer_exports, {
|
|
20
|
+
getFileFromDataTransfer: () => getFileFromDataTransfer
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(getFileFromDataTransfer_exports);
|
|
23
|
+
function getFileFromDataTransfer(dataTransfer) {
|
|
24
|
+
var _a;
|
|
25
|
+
if (!dataTransfer) {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
const items = dataTransfer.items ?? [];
|
|
29
|
+
if (items.length >= 2 && items[0].kind === "string" && items[1].kind === "file") {
|
|
30
|
+
const text = dataTransfer.getData("text");
|
|
31
|
+
const file = items[1].getAsFile() ?? ((_a = dataTransfer.files) == null ? void 0 : _a.item(0));
|
|
32
|
+
if (!file) {
|
|
33
|
+
console.error(`no file ${text}`, items[1]);
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
return { file, name: text };
|
|
37
|
+
} else if (items[0].kind === "file") {
|
|
38
|
+
const file = items[0].getAsFile();
|
|
39
|
+
if (!file) {
|
|
40
|
+
console.error(`no file`, items[0]);
|
|
41
|
+
return {};
|
|
42
|
+
}
|
|
43
|
+
return { file, name: file.name };
|
|
44
|
+
} else {
|
|
45
|
+
console.debug(`file item not match`, Array.from(items).map((v) => ({ type: v.type, kind: v.kind })));
|
|
46
|
+
}
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var browsers_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(browsers_exports);
|
|
17
|
+
__reExport(browsers_exports, require("./copy"), module.exports);
|
|
18
|
+
__reExport(browsers_exports, require("./download"), module.exports);
|
|
19
|
+
__reExport(browsers_exports, require("./loaders"), module.exports);
|
|
20
|
+
__reExport(browsers_exports, require("./getFileFromDataTransfer"), module.exports);
|
|
@@ -1,41 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var loaders_exports = {};
|
|
19
|
+
__export(loaders_exports, {
|
|
20
|
+
loadScripts: () => loadScripts,
|
|
21
|
+
loadStyles: () => loadStyles
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(loaders_exports);
|
|
4
24
|
function load(el, resolve, reject, options) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return el.setAttribute(k, v);
|
|
14
|
-
});
|
|
15
|
-
document.head.appendChild(el);
|
|
25
|
+
el.onload = resolve;
|
|
26
|
+
el.onerror = (e) => {
|
|
27
|
+
el.remove();
|
|
28
|
+
reject(e);
|
|
29
|
+
};
|
|
30
|
+
const { attributes = {} } = options || {};
|
|
31
|
+
Object.entries(attributes).forEach(([k, v]) => el.setAttribute(k, v));
|
|
32
|
+
document.head.appendChild(el);
|
|
16
33
|
}
|
|
17
34
|
function loadScripts(src, options) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
35
|
+
if (document.querySelector(`script[src="${src}"]`)) {
|
|
36
|
+
return Promise.resolve();
|
|
37
|
+
}
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
const el = document.createElement("script");
|
|
40
|
+
el.src = src;
|
|
41
|
+
load(el, resolve, reject, options);
|
|
42
|
+
});
|
|
27
43
|
}
|
|
28
|
-
exports.loadScripts = loadScripts;
|
|
29
44
|
function loadStyles(href, options) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
if (document.querySelector(`link[href="${href}"]`)) {
|
|
46
|
+
return Promise.resolve();
|
|
47
|
+
}
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
const el = document.createElement("link");
|
|
50
|
+
el.rel = "stylesheet";
|
|
51
|
+
el.href = href;
|
|
52
|
+
load(el, resolve, reject, options);
|
|
53
|
+
});
|
|
39
54
|
}
|
|
40
|
-
exports.loadStyles = loadStyles;
|
|
41
|
-
//# sourceMappingURL=loaders.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var formatBytes_exports = {};
|
|
19
|
+
__export(formatBytes_exports, {
|
|
20
|
+
formatBytes: () => formatBytes
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(formatBytes_exports);
|
|
23
|
+
function formatBytes(bytes, si = false, dp = 1) {
|
|
24
|
+
const thresh = si ? 1e3 : 1024;
|
|
25
|
+
if (Math.abs(bytes) < thresh) {
|
|
26
|
+
return bytes + " B";
|
|
27
|
+
}
|
|
28
|
+
const units = si ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
|
29
|
+
let u = -1;
|
|
30
|
+
const r = 10 ** dp;
|
|
31
|
+
do {
|
|
32
|
+
bytes /= thresh;
|
|
33
|
+
++u;
|
|
34
|
+
} while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
|
|
35
|
+
return bytes.toFixed(dp) + " " + units[u];
|
|
36
|
+
}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,13 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var src_exports = {};
|
|
20
|
+
__export(src_exports, {
|
|
21
|
+
formatBytes: () => import_formatBytes.formatBytes,
|
|
22
|
+
getGlobalThis: () => import_getGlobalThis.getGlobalThis,
|
|
23
|
+
urljoin: () => import_urljoin.urljoin
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
__reExport(src_exports, require("./arrays/index"), module.exports);
|
|
27
|
+
__reExport(src_exports, require("./asyncs"), module.exports);
|
|
28
|
+
__reExport(src_exports, require("./validations"), module.exports);
|
|
29
|
+
__reExport(src_exports, require("./strings"), module.exports);
|
|
30
|
+
__reExport(src_exports, require("./maths"), module.exports);
|
|
31
|
+
__reExport(src_exports, require("./io"), module.exports);
|
|
32
|
+
__reExport(src_exports, require("./browsers"), module.exports);
|
|
33
|
+
var import_getGlobalThis = require("./isomorphics/getGlobalThis");
|
|
34
|
+
var import_formatBytes = require("./formats/formatBytes");
|
|
35
|
+
var import_urljoin = require("./shim/urljoin");
|
package/lib/cjs/io/index.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var io_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(io_exports);
|
|
17
|
+
__reExport(io_exports, require("./isBuffer"), module.exports);
|
package/lib/cjs/io/isBuffer.js
CHANGED
|
@@ -1,12 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var isBuffer_exports = {};
|
|
19
|
+
__export(isBuffer_exports, {
|
|
20
|
+
isBuffer: () => isBuffer
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(isBuffer_exports);
|
|
5
23
|
function isBuffer(obj) {
|
|
6
|
-
|
|
7
|
-
obj.constructor != null &&
|
|
8
|
-
typeof obj.constructor.isBuffer === 'function' &&
|
|
9
|
-
obj.constructor.isBuffer(obj));
|
|
24
|
+
return obj != null && obj.constructor != null && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
10
25
|
}
|
|
11
|
-
exports.isBuffer = isBuffer;
|
|
12
|
-
//# sourceMappingURL=isBuffer.js.map
|
|
@@ -1,28 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var getGlobalThis_exports = {};
|
|
19
|
+
__export(getGlobalThis_exports, {
|
|
20
|
+
getGlobalThis: () => getGlobalThis
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(getGlobalThis_exports);
|
|
23
|
+
const getGlobalThis = () => {
|
|
24
|
+
if (typeof globalThis !== "undefined")
|
|
25
|
+
return globalThis;
|
|
26
|
+
if (typeof self !== "undefined")
|
|
27
|
+
return self;
|
|
28
|
+
if (typeof window !== "undefined")
|
|
29
|
+
return window;
|
|
30
|
+
if (typeof global !== "undefined")
|
|
31
|
+
return global;
|
|
32
|
+
throw new Error("Unable to locate global `this`");
|
|
27
33
|
};
|
|
28
|
-
//# sourceMappingURL=getGlobalThis.js.map
|
package/lib/cjs/maths/index.js
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var maths_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(maths_exports);
|
|
17
|
+
__reExport(maths_exports, require("./random"), module.exports);
|
package/lib/cjs/maths/random.js
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var random_exports = {};
|
|
19
|
+
__export(random_exports, {
|
|
20
|
+
createRandom: () => createRandom
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(random_exports);
|
|
23
|
+
function createRandom(o = {}) {
|
|
24
|
+
let seed = typeof o.seed === "string" ? 0 : o.seed ?? 0;
|
|
25
|
+
if (typeof o.seed === "string") {
|
|
26
|
+
let sum = 0;
|
|
27
|
+
for (let i = 0; i < o.seed.length; i++) {
|
|
28
|
+
sum += o.seed.charCodeAt(i);
|
|
14
29
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
30
|
+
seed = sum;
|
|
31
|
+
}
|
|
32
|
+
return () => {
|
|
33
|
+
const x = Math.sin(seed++) * 1e4;
|
|
34
|
+
return x - Math.floor(x);
|
|
35
|
+
};
|
|
19
36
|
}
|
|
20
|
-
exports.createRandom = createRandom;
|
|
21
|
-
//# sourceMappingURL=random.js.map
|