@wener/utils 1.1.1 → 1.1.3
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/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/server.js +2 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/server.js +2 -0
- package/dist/esm/server.js.map +1 -0
- package/dist/system/index.js +2 -0
- package/dist/system/index.js.map +1 -0
- package/dist/system/server.js +2 -0
- package/dist/system/server.js.map +1 -0
- package/index.ts +1 -0
- package/lib/{esm/arrays → arrays}/MaybeArray.js +3 -6
- package/lib/arrays/MaybeArray.js.map +1 -0
- package/lib/{esm/asyncs → asyncs}/AsyncInterval.js +4 -5
- package/lib/asyncs/AsyncInterval.js.map +1 -0
- package/lib/asyncs/LazyPromise.js +27 -0
- package/lib/asyncs/LazyPromise.js.map +1 -0
- package/lib/{esm/asyncs → asyncs}/isPromise.js +3 -3
- package/lib/asyncs/isPromise.js.map +1 -0
- package/lib/{esm/asyncs → asyncs}/sleep.js +3 -3
- package/lib/asyncs/sleep.js.map +1 -0
- package/lib/{esm/asyncs → asyncs}/timeout.js +13 -11
- package/lib/asyncs/timeout.js.map +1 -0
- package/lib/{esm/browsers → browsers}/copy.js +7 -8
- package/lib/browsers/copy.js.map +1 -0
- package/lib/{esm/browsers → browsers}/download.js +3 -3
- package/lib/browsers/download.js.map +1 -0
- package/lib/{esm/browsers → browsers}/getFileFromDataTransfer.js +8 -6
- package/lib/browsers/getFileFromDataTransfer.js.map +1 -0
- package/lib/{esm/browsers → browsers}/loaders.js +24 -9
- package/lib/browsers/loaders.js.map +1 -0
- package/lib/crypto/hashing.js +24 -0
- package/lib/crypto/hashing.js.map +1 -0
- package/lib/crypto/hex.js +6 -0
- package/lib/crypto/hex.js.map +1 -0
- package/lib/crypto/randomUUID.js +13 -0
- package/lib/crypto/randomUUID.js.map +1 -0
- package/lib/{esm/formats → formats}/formatBytes.js +3 -3
- package/lib/formats/formatBytes.js.map +1 -0
- package/lib/index.js +27 -0
- package/lib/index.js.map +1 -0
- package/lib/{esm/io → io}/isBuffer.js +3 -3
- package/lib/io/isBuffer.js.map +1 -0
- package/lib/{esm/isomorphics → isomorphics}/getGlobalThis.js +3 -3
- package/lib/isomorphics/getGlobalThis.js.map +1 -0
- package/lib/{esm/maths → maths}/random.js +3 -3
- package/lib/maths/random.js.map +1 -0
- package/lib/modules/parseModuleId.js +31 -0
- package/lib/modules/parseModuleId.js.map +1 -0
- package/lib/server/polyfill.js +8 -0
- package/lib/server/polyfill.js.map +1 -0
- package/lib/server.js +2 -0
- package/lib/server.js.map +1 -0
- package/lib/{esm/shim → shim}/urljoin.js +3 -3
- package/lib/shim/urljoin.js.map +1 -0
- package/lib/{esm/strings → strings}/camelCase.js +3 -4
- package/lib/strings/camelCase.js.map +1 -0
- package/lib/{esm/strings → strings}/templates.js +3 -3
- package/lib/strings/templates.js.map +1 -0
- package/lib/validations/dequal.js +95 -0
- package/lib/validations/dequal.js.map +1 -0
- package/lib/{esm/validations → validations}/isClass.js +3 -3
- package/lib/validations/isClass.js.map +1 -0
- package/lib/{esm/validations → validations}/isDefined.js +3 -3
- package/lib/validations/isDefined.js.map +1 -0
- package/lib/{esm/validations → validations}/isEmptyObject.js +3 -3
- package/lib/validations/isEmptyObject.js.map +1 -0
- package/lib/validations/shallow.js +21 -0
- package/lib/validations/shallow.js.map +1 -0
- package/package.json +62 -47
- package/server.ts +1 -0
- package/src/arrays/MaybeArray.ts +8 -4
- package/src/browsers/copy.ts +7 -3
- package/src/browsers/download.ts +7 -0
- package/src/browsers/loaders.ts +32 -7
- package/src/crypto/hashing.test.ts +26 -0
- package/src/crypto/hashing.ts +27 -0
- package/src/crypto/hex.ts +5 -0
- package/src/crypto/randomUUID.ts +13 -0
- package/src/index.ts +46 -7
- package/src/modules/parseModuleId.test.ts +68 -0
- package/src/modules/parseModuleId.ts +46 -0
- package/src/server/polyfill.ts +5 -0
- package/src/server.ts +1 -0
- package/src/shim/urljoin.test.ts +3 -2
- package/src/types.d.ts +7 -0
- package/src/validations/dequal.test.ts +17 -0
- package/src/validations/dequal.ts +105 -0
- package/src/validations/shallow.ts +26 -0
- package/tsconfig.json +5 -9
- package/jest.config.js +0 -18
- package/jest.setup.js +0 -1
- package/lib/cjs/arrays/MaybeArray.js +0 -52
- package/lib/cjs/arrays/index.js +0 -17
- package/lib/cjs/asyncs/AsyncInterval.js +0 -35
- package/lib/cjs/asyncs/LazyPromise.js +0 -43
- package/lib/cjs/asyncs/MaybePromise.js +0 -15
- package/lib/cjs/asyncs/generatorOfStream.js +0 -35
- package/lib/cjs/asyncs/index.js +0 -23
- package/lib/cjs/asyncs/isPromise.js +0 -25
- package/lib/cjs/asyncs/promiseOfCallback.js +0 -37
- package/lib/cjs/asyncs/sleep.js +0 -23
- package/lib/cjs/asyncs/timeout.js +0 -44
- package/lib/cjs/browsers/copy.js +0 -71
- package/lib/cjs/browsers/download.js +0 -47
- package/lib/cjs/browsers/getFileFromDataTransfer.js +0 -48
- package/lib/cjs/browsers/index.js +0 -20
- package/lib/cjs/browsers/loaders.js +0 -54
- package/lib/cjs/formats/formatBytes.js +0 -36
- package/lib/cjs/index.js +0 -35
- package/lib/cjs/io/index.js +0 -17
- package/lib/cjs/io/isBuffer.js +0 -25
- package/lib/cjs/isomorphics/getGlobalThis.js +0 -33
- package/lib/cjs/maths/index.js +0 -17
- package/lib/cjs/maths/random.js +0 -36
- package/lib/cjs/shim/urljoin.js +0 -70
- package/lib/cjs/shim/urljoin.test.js +0 -4
- package/lib/cjs/strings/camelCase.js +0 -76
- package/lib/cjs/strings/index.js +0 -18
- package/lib/cjs/strings/templates.js +0 -27
- package/lib/cjs/validations/asserts.js +0 -29
- package/lib/cjs/validations/index.js +0 -20
- package/lib/cjs/validations/isClass.js +0 -25
- package/lib/cjs/validations/isDefined.js +0 -25
- package/lib/cjs/validations/isEmptyObject.js +0 -28
- package/lib/esm/arrays/MaybeArray.d.ts +0 -5
- package/lib/esm/arrays/index.d.ts +0 -1
- package/lib/esm/arrays/index.js +0 -1
- package/lib/esm/asyncs/AsyncInterval.d.ts +0 -3
- package/lib/esm/asyncs/LazyPromise.d.ts +0 -5
- package/lib/esm/asyncs/LazyPromise.js +0 -24
- package/lib/esm/asyncs/MaybePromise.d.ts +0 -1
- package/lib/esm/asyncs/MaybePromise.js +0 -0
- package/lib/esm/asyncs/generatorOfStream.d.ts +0 -1
- package/lib/esm/asyncs/generatorOfStream.js +0 -16
- package/lib/esm/asyncs/index.d.ts +0 -7
- package/lib/esm/asyncs/index.js +0 -7
- package/lib/esm/asyncs/isPromise.d.ts +0 -1
- package/lib/esm/asyncs/promiseOfCallback.d.ts +0 -1
- package/lib/esm/asyncs/promiseOfCallback.js +0 -18
- package/lib/esm/asyncs/sleep.d.ts +0 -1
- package/lib/esm/asyncs/timeout.d.ts +0 -4
- package/lib/esm/browsers/copy.d.ts +0 -1
- package/lib/esm/browsers/download.d.ts +0 -4
- package/lib/esm/browsers/getFileFromDataTransfer.d.ts +0 -4
- package/lib/esm/browsers/index.d.ts +0 -4
- package/lib/esm/browsers/index.js +0 -4
- package/lib/esm/browsers/loaders.d.ts +0 -6
- package/lib/esm/formats/formatBytes.d.ts +0 -11
- package/lib/esm/index.d.ts +0 -10
- package/lib/esm/index.js +0 -15
- package/lib/esm/io/index.d.ts +0 -1
- package/lib/esm/io/index.js +0 -1
- package/lib/esm/io/isBuffer.d.ts +0 -2
- package/lib/esm/isomorphics/getGlobalThis.d.ts +0 -9
- package/lib/esm/maths/index.d.ts +0 -1
- package/lib/esm/maths/index.js +0 -1
- package/lib/esm/maths/random.d.ts +0 -3
- package/lib/esm/shim/urljoin.d.ts +0 -2
- package/lib/esm/shim/urljoin.test.d.ts +0 -1
- package/lib/esm/shim/urljoin.test.js +0 -4
- package/lib/esm/strings/camelCase.d.ts +0 -4
- package/lib/esm/strings/index.d.ts +0 -2
- package/lib/esm/strings/index.js +0 -2
- package/lib/esm/strings/templates.d.ts +0 -7
- package/lib/esm/validations/asserts.d.ts +0 -2
- package/lib/esm/validations/asserts.js +0 -10
- package/lib/esm/validations/index.d.ts +0 -4
- package/lib/esm/validations/index.js +0 -4
- package/lib/esm/validations/isClass.d.ts +0 -1
- package/lib/esm/validations/isDefined.d.ts +0 -1
- package/lib/esm/validations/isEmptyObject.d.ts +0 -1
- package/src/arrays/index.ts +0 -1
- package/src/asyncs/index.ts +0 -8
- package/src/browsers/index.ts +0 -4
- package/src/io/index.ts +0 -1
- package/src/maths/index.ts +0 -1
- package/src/strings/index.ts +0 -2
- package/src/validations/index.ts +0 -4
- package/tsconfig.jest.json +0 -7
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
function* generatorOfStream(stream) {
|
|
2
|
-
let done = false;
|
|
3
|
-
stream.on("end", () => {
|
|
4
|
-
done = true;
|
|
5
|
-
});
|
|
6
|
-
while (!done) {
|
|
7
|
-
yield new Promise((resolve, reject) => {
|
|
8
|
-
stream.once("data", resolve);
|
|
9
|
-
stream.once("end", resolve);
|
|
10
|
-
stream.once("error", reject);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export {
|
|
15
|
-
generatorOfStream
|
|
16
|
-
};
|
package/lib/esm/asyncs/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isPromise<T>(v: any): v is Promise<T>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function promiseOfCallback<T>(fun: (cb: (err: any, val?: T) => void) => void): Promise<T>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
function promiseOfCallback(fun) {
|
|
2
|
-
return new Promise((resolve, reject) => {
|
|
3
|
-
try {
|
|
4
|
-
fun((e, v) => {
|
|
5
|
-
if (e) {
|
|
6
|
-
reject(e);
|
|
7
|
-
} else {
|
|
8
|
-
resolve(v);
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
} catch (e) {
|
|
12
|
-
reject(e);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
export {
|
|
17
|
-
promiseOfCallback
|
|
18
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function copy(text: string): void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Format bytes as human-readable text.
|
|
3
|
-
*
|
|
4
|
-
* @param bytes Number of bytes.
|
|
5
|
-
* @param si True to use metric (SI) units, aka powers of 1000. False to use
|
|
6
|
-
* binary (IEC), aka powers of 1024.
|
|
7
|
-
* @param dp Number of decimal places to display.
|
|
8
|
-
*
|
|
9
|
-
* @return Formatted string.
|
|
10
|
-
*/
|
|
11
|
-
export declare function formatBytes(bytes: number, si?: boolean, dp?: number): string;
|
package/lib/esm/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './arrays/index';
|
|
2
|
-
export * from './asyncs';
|
|
3
|
-
export * from './validations';
|
|
4
|
-
export * from './strings';
|
|
5
|
-
export * from './maths';
|
|
6
|
-
export * from './io';
|
|
7
|
-
export * from './browsers';
|
|
8
|
-
export { getGlobalThis } from './isomorphics/getGlobalThis';
|
|
9
|
-
export { formatBytes } from './formats/formatBytes';
|
|
10
|
-
export { urljoin } from './shim/urljoin';
|
package/lib/esm/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from "./arrays/index";
|
|
2
|
-
export * from "./asyncs";
|
|
3
|
-
export * from "./validations";
|
|
4
|
-
export * from "./strings";
|
|
5
|
-
export * from "./maths";
|
|
6
|
-
export * from "./io";
|
|
7
|
-
export * from "./browsers";
|
|
8
|
-
import { getGlobalThis } from "./isomorphics/getGlobalThis";
|
|
9
|
-
import { formatBytes } from "./formats/formatBytes";
|
|
10
|
-
import { urljoin } from "./shim/urljoin";
|
|
11
|
-
export {
|
|
12
|
-
formatBytes,
|
|
13
|
-
getGlobalThis,
|
|
14
|
-
urljoin
|
|
15
|
-
};
|
package/lib/esm/io/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './isBuffer';
|
package/lib/esm/io/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./isBuffer";
|
package/lib/esm/io/isBuffer.d.ts
DELETED
package/lib/esm/maths/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './random';
|
package/lib/esm/maths/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./random";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/esm/strings/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isClass(func: any): boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isDefined<T = any>(v: T): v is NonNullable<T>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isEmptyObject(o: any): boolean;
|
package/src/arrays/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './MaybeArray';
|
package/src/asyncs/index.ts
DELETED
package/src/browsers/index.ts
DELETED
package/src/io/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './isBuffer';
|
package/src/maths/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './random';
|
package/src/strings/index.ts
DELETED
package/src/validations/index.ts
DELETED