@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,70 @@
|
|
|
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 urljoin_exports = {};
|
|
19
|
+
__export(urljoin_exports, {
|
|
20
|
+
urljoin: () => urljoin
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(urljoin_exports);
|
|
23
|
+
function urljoin(...args) {
|
|
24
|
+
if (Array.isArray(args[0])) {
|
|
25
|
+
return normalize(args[0]);
|
|
26
|
+
} else {
|
|
27
|
+
return normalize(args);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function normalize(strArray) {
|
|
31
|
+
const resultArray = [];
|
|
32
|
+
if (strArray.length === 0) {
|
|
33
|
+
return "";
|
|
34
|
+
}
|
|
35
|
+
if (typeof strArray[0] !== "string") {
|
|
36
|
+
throw new TypeError("Url must be a string. Received " + strArray[0]);
|
|
37
|
+
}
|
|
38
|
+
if (strArray[0].match(/^[^/:]+:\/*$/) && strArray.length > 1) {
|
|
39
|
+
const first = strArray.shift();
|
|
40
|
+
strArray[0] = first + strArray[0];
|
|
41
|
+
}
|
|
42
|
+
if (strArray[0].match(/^file:\/\/\//)) {
|
|
43
|
+
strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1:///");
|
|
44
|
+
} else {
|
|
45
|
+
strArray[0] = strArray[0].replace(/^([^/:]+):\/*/, "$1://");
|
|
46
|
+
}
|
|
47
|
+
for (let i = 0; i < strArray.length; i++) {
|
|
48
|
+
let component = strArray[i];
|
|
49
|
+
if (typeof component !== "string") {
|
|
50
|
+
throw new TypeError("Url must be a string. Received " + component);
|
|
51
|
+
}
|
|
52
|
+
if (component === "") {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (i > 0) {
|
|
56
|
+
component = component.replace(/^[\/]+/, "");
|
|
57
|
+
}
|
|
58
|
+
if (i < strArray.length - 1) {
|
|
59
|
+
component = component.replace(/[\/]+$/, "");
|
|
60
|
+
} else {
|
|
61
|
+
component = component.replace(/[\/]+$/, "/");
|
|
62
|
+
}
|
|
63
|
+
resultArray.push(component);
|
|
64
|
+
}
|
|
65
|
+
let str = resultArray.join("/");
|
|
66
|
+
str = str.replace(/\/(\?|&|#[^!])/g, "$1");
|
|
67
|
+
const parts = str.split("?");
|
|
68
|
+
str = parts.shift() + (parts.length > 0 ? "?" : "") + parts.join("&");
|
|
69
|
+
return str;
|
|
70
|
+
}
|
|
@@ -1,74 +1,76 @@
|
|
|
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 camelCase_exports = {};
|
|
19
|
+
__export(camelCase_exports, {
|
|
20
|
+
camelCase: () => camelCase,
|
|
21
|
+
pascalCase: () => pascalCase
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(camelCase_exports);
|
|
5
24
|
function preserveCamelCase(string) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
|
|
29
|
-
isLastLastCharUpper = isLastCharUpper;
|
|
30
|
-
isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
|
|
31
|
-
}
|
|
25
|
+
let isLastCharLower = false;
|
|
26
|
+
let isLastCharUpper = false;
|
|
27
|
+
let isLastLastCharUpper = false;
|
|
28
|
+
for (let i = 0; i < string.length; i++) {
|
|
29
|
+
const character = string[i];
|
|
30
|
+
if (isLastCharLower && /[a-zA-Z]/.test(character) && character.toUpperCase() === character) {
|
|
31
|
+
string = string.slice(0, i) + "-" + string.slice(i);
|
|
32
|
+
isLastCharLower = false;
|
|
33
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
34
|
+
isLastCharUpper = true;
|
|
35
|
+
i++;
|
|
36
|
+
} else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(character) && character.toLowerCase() === character) {
|
|
37
|
+
string = string.slice(0, i - 1) + "-" + string.slice(i - 1);
|
|
38
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
39
|
+
isLastCharUpper = false;
|
|
40
|
+
isLastCharLower = true;
|
|
41
|
+
} else {
|
|
42
|
+
isLastCharLower = character.toLowerCase() === character && character.toUpperCase() !== character;
|
|
43
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
44
|
+
isLastCharUpper = character.toUpperCase() === character && character.toLowerCase() !== character;
|
|
32
45
|
}
|
|
33
|
-
|
|
46
|
+
}
|
|
47
|
+
return string;
|
|
34
48
|
}
|
|
35
49
|
function pascalCase(input) {
|
|
36
|
-
|
|
50
|
+
return camelCase(input, { pascalCase: true });
|
|
37
51
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var hasUpperCase = input !== input.toLowerCase();
|
|
63
|
-
if (hasUpperCase) {
|
|
64
|
-
input = preserveCamelCase(input);
|
|
65
|
-
}
|
|
66
|
-
input = input
|
|
67
|
-
.replace(/^[_.\- ]+/, '')
|
|
68
|
-
.toLowerCase()
|
|
69
|
-
.replace(/[_.\- ]+(\w|$)/g, function (_, p1) { return p1.toUpperCase(); })
|
|
70
|
-
.replace(/\d+(\w|$)/g, function (m) { return m.toUpperCase(); });
|
|
71
|
-
return postProcess(input);
|
|
52
|
+
function camelCase(input, options = {
|
|
53
|
+
pascalCase: false
|
|
54
|
+
}) {
|
|
55
|
+
if (!(typeof input === "string" || Array.isArray(input))) {
|
|
56
|
+
throw new TypeError("Expected the input to be `string | string[]`");
|
|
57
|
+
}
|
|
58
|
+
const postProcess = (x) => options.pascalCase ? x.charAt(0).toUpperCase() + x.slice(1) : x;
|
|
59
|
+
if (Array.isArray(input)) {
|
|
60
|
+
input = input.map((x) => x.trim()).filter((x) => x.length).join("-");
|
|
61
|
+
} else {
|
|
62
|
+
input = input.trim();
|
|
63
|
+
}
|
|
64
|
+
if (input.length === 0) {
|
|
65
|
+
return "";
|
|
66
|
+
}
|
|
67
|
+
if (input.length === 1) {
|
|
68
|
+
return options.pascalCase ? input.toUpperCase() : input.toLowerCase();
|
|
69
|
+
}
|
|
70
|
+
const hasUpperCase = input !== input.toLowerCase();
|
|
71
|
+
if (hasUpperCase) {
|
|
72
|
+
input = preserveCamelCase(input);
|
|
73
|
+
}
|
|
74
|
+
input = input.replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+(\w|$)/g, (_, p1) => p1.toUpperCase()).replace(/\d+(\w|$)/g, (m) => m.toUpperCase());
|
|
75
|
+
return postProcess(input);
|
|
72
76
|
}
|
|
73
|
-
exports.camelCase = camelCase;
|
|
74
|
-
//# sourceMappingURL=camelCase.js.map
|
package/lib/cjs/strings/index.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 strings_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(strings_exports);
|
|
17
|
+
__reExport(strings_exports, require("./camelCase"), module.exports);
|
|
18
|
+
__reExport(strings_exports, require("./templates"), module.exports);
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 templates_exports = {};
|
|
19
|
+
__export(templates_exports, {
|
|
20
|
+
templateString: () => templateString
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(templates_exports);
|
|
23
|
+
function templateString(template, getter) {
|
|
24
|
+
return template.replace(/\${(.*?)}/g, (_, g) => {
|
|
25
|
+
return getter(g.trim());
|
|
26
|
+
});
|
|
17
27
|
}
|
|
18
|
-
exports.templateString = templateString;
|
|
19
|
-
//# sourceMappingURL=templates.js.map
|
|
@@ -1,18 +1,29 @@
|
|
|
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 asserts_exports = {};
|
|
19
|
+
__export(asserts_exports, {
|
|
20
|
+
assert: () => assert,
|
|
21
|
+
assertIsDefined: () => assertIsDefined
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(asserts_exports);
|
|
4
24
|
function assert(condition, msg) {
|
|
5
|
-
|
|
6
|
-
// throw new AssertionError(msg);
|
|
7
|
-
// }
|
|
8
|
-
console.assert(!condition, msg);
|
|
25
|
+
console.assert(!condition, msg);
|
|
9
26
|
}
|
|
10
|
-
exports.assert = assert;
|
|
11
27
|
function assertIsDefined(val) {
|
|
12
|
-
|
|
13
|
-
// throw new AssertionError(`Expected 'val' to be defined, but received ${val}`);
|
|
14
|
-
// }
|
|
15
|
-
console.assert(val === undefined || val === null, 'Expected defined');
|
|
28
|
+
console.assert(val === void 0 || val === null, "Expected defined");
|
|
16
29
|
}
|
|
17
|
-
exports.assertIsDefined = assertIsDefined;
|
|
18
|
-
//# sourceMappingURL=asserts.js.map
|
|
@@ -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 validations_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(validations_exports);
|
|
17
|
+
__reExport(validations_exports, require("./asserts"), module.exports);
|
|
18
|
+
__reExport(validations_exports, require("./isDefined"), module.exports);
|
|
19
|
+
__reExport(validations_exports, require("./isEmptyObject"), module.exports);
|
|
20
|
+
__reExport(validations_exports, require("./isClass"), module.exports);
|
|
@@ -1,8 +1,25 @@
|
|
|
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 isClass_exports = {};
|
|
19
|
+
__export(isClass_exports, {
|
|
20
|
+
isClass: () => isClass
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(isClass_exports);
|
|
4
23
|
function isClass(func) {
|
|
5
|
-
|
|
24
|
+
return typeof func === "function" && /^class\s/.test(Function.prototype.toString.call(func));
|
|
6
25
|
}
|
|
7
|
-
exports.isClass = isClass;
|
|
8
|
-
//# sourceMappingURL=isClass.js.map
|
|
@@ -1,8 +1,25 @@
|
|
|
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 isDefined_exports = {};
|
|
19
|
+
__export(isDefined_exports, {
|
|
20
|
+
isDefined: () => isDefined
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(isDefined_exports);
|
|
4
23
|
function isDefined(v) {
|
|
5
|
-
|
|
24
|
+
return v !== null && v !== void 0;
|
|
6
25
|
}
|
|
7
|
-
exports.isDefined = isDefined;
|
|
8
|
-
//# sourceMappingURL=isDefined.js.map
|
|
@@ -1,11 +1,28 @@
|
|
|
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 isEmptyObject_exports = {};
|
|
19
|
+
__export(isEmptyObject_exports, {
|
|
20
|
+
isEmptyObject: () => isEmptyObject
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(isEmptyObject_exports);
|
|
4
23
|
function isEmptyObject(o) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
24
|
+
if (o === null || o === void 0) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
return o.constructor === Object && Object.keys(o).length === 0;
|
|
9
28
|
}
|
|
10
|
-
exports.isEmptyObject = isEmptyObject;
|
|
11
|
-
//# sourceMappingURL=isEmptyObject.js.map
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var k = _a[0], v = _a[1];
|
|
7
|
-
return [k, picker(v)];
|
|
8
|
-
}));
|
|
9
|
-
}
|
|
10
|
-
return Object.fromEntries(keys.map(function (v) { return [v, picker(v)]; }));
|
|
1
|
+
function objectOfMaybeArray(o, keys = null, picker = firstOfMaybeArray) {
|
|
2
|
+
if (keys === null) {
|
|
3
|
+
return Object.fromEntries(Object.entries(o).map(([k, v]) => [k, picker(v)]));
|
|
4
|
+
}
|
|
5
|
+
return Object.fromEntries(keys.map((v) => [v, picker(v)]));
|
|
11
6
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
function firstOfMaybeArray(v) {
|
|
8
|
+
if (Array.isArray(v)) {
|
|
9
|
+
return v[0];
|
|
10
|
+
}
|
|
11
|
+
return v;
|
|
17
12
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
function lastOfMaybeArray(v) {
|
|
14
|
+
if (Array.isArray(v)) {
|
|
15
|
+
return v[v.length - 1];
|
|
16
|
+
}
|
|
17
|
+
return v;
|
|
23
18
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
function arrayOfMaybeArray(v) {
|
|
20
|
+
if (Array.isArray(v)) {
|
|
21
|
+
return v;
|
|
22
|
+
}
|
|
23
|
+
if (v === null || v === void 0) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
return [v];
|
|
32
27
|
}
|
|
33
|
-
|
|
28
|
+
export {
|
|
29
|
+
arrayOfMaybeArray,
|
|
30
|
+
firstOfMaybeArray,
|
|
31
|
+
lastOfMaybeArray,
|
|
32
|
+
objectOfMaybeArray
|
|
33
|
+
};
|
package/lib/esm/arrays/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from "./MaybeArray";
|
|
@@ -1,23 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
case 0: return [4 /*yield*/, cb()];
|
|
10
|
-
case 1:
|
|
11
|
-
_a.sent();
|
|
12
|
-
id = setTimeout(handler, interval);
|
|
13
|
-
return [2 /*return*/];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
}); };
|
|
17
|
-
id = setTimeout(handler, initial);
|
|
18
|
-
return function () { return id; };
|
|
1
|
+
function setAsyncInterval(cb, interval, initial = interval) {
|
|
2
|
+
let id;
|
|
3
|
+
const handler = async () => {
|
|
4
|
+
await cb();
|
|
5
|
+
id = setTimeout(handler, interval);
|
|
6
|
+
};
|
|
7
|
+
id = setTimeout(handler, initial);
|
|
8
|
+
return () => id;
|
|
19
9
|
}
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
function clearAsyncInterval(v) {
|
|
11
|
+
clearTimeout(v == null ? void 0 : v());
|
|
22
12
|
}
|
|
23
|
-
|
|
13
|
+
export {
|
|
14
|
+
clearAsyncInterval,
|
|
15
|
+
setAsyncInterval
|
|
16
|
+
};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
function createLazyPromise() {
|
|
2
|
+
const holder = {
|
|
3
|
+
resolve(_) {
|
|
4
|
+
throw new Error("pending resolve");
|
|
5
|
+
},
|
|
6
|
+
reject(_) {
|
|
7
|
+
throw new Error("pending reject");
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
return Object.assign(new Promise((resolve, reject) => {
|
|
11
|
+
holder.reject = reject;
|
|
12
|
+
holder.resolve = resolve;
|
|
13
|
+
}), {
|
|
14
|
+
resolve(v) {
|
|
15
|
+
holder.resolve(v);
|
|
16
|
+
},
|
|
17
|
+
reject(v) {
|
|
18
|
+
holder.resolve(v);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
export {
|
|
23
|
+
createLazyPromise
|
|
24
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=MaybePromise.js.map
|