@tb-dev/utils 1.7.0 → 1.7.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/dist/index.cjs +5 -19
- package/dist/index.js +3 -18
- package/dist/promise.cjs +10 -0
- package/dist/promise.js +10 -0
- package/dist/string.cjs +14 -0
- package/dist/string.js +14 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,22 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const regex = require("./regex.cjs");
|
|
4
4
|
const array = require("./array.cjs");
|
|
5
5
|
const panic = require("./panic.cjs");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return [];
|
|
9
|
-
if (Array.isArray(value)) {
|
|
10
|
-
const array2 = value.map((i) => splitWhitespace(i));
|
|
11
|
-
return array2.flat(Number.POSITIVE_INFINITY);
|
|
12
|
-
}
|
|
13
|
-
value = value.trim().split(/\s/);
|
|
14
|
-
return array.trimArray(value);
|
|
15
|
-
}
|
|
16
|
-
function flush() {
|
|
17
|
-
return new Promise((resolve) => void setTimeout(resolve, 0));
|
|
18
|
-
}
|
|
19
|
-
function sleep(ms) {
|
|
20
|
-
return new Promise((resolve) => void setTimeout(resolve, ms));
|
|
21
|
-
}
|
|
6
|
+
const string = require("./string.cjs");
|
|
7
|
+
const promise = require("./promise.cjs");
|
|
22
8
|
function isEmpty(value) {
|
|
23
9
|
if (isNullish(value)) {
|
|
24
10
|
return true;
|
|
@@ -50,10 +36,10 @@ exports.panic = panic.panic;
|
|
|
50
36
|
exports.todo = panic.todo;
|
|
51
37
|
exports.unimplemented = panic.unimplemented;
|
|
52
38
|
exports.unreachable = panic.unreachable;
|
|
53
|
-
exports.
|
|
39
|
+
exports.splitWhitespace = string.splitWhitespace;
|
|
40
|
+
exports.flush = promise.flush;
|
|
41
|
+
exports.sleep = promise.sleep;
|
|
54
42
|
exports.isEmpty = isEmpty;
|
|
55
43
|
exports.isNullish = isNullish;
|
|
56
44
|
exports.noop = noop;
|
|
57
|
-
exports.sleep = sleep;
|
|
58
|
-
exports.splitWhitespace = splitWhitespace;
|
|
59
45
|
exports.toPixel = toPixel;
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import { regex } from "./regex.js";
|
|
2
|
-
import { trimArray } from "./array.js";
|
|
3
|
-
import { toArray, upsert } from "./array.js";
|
|
2
|
+
import { toArray, trimArray, upsert } from "./array.js";
|
|
4
3
|
import { panic, todo, unimplemented, unreachable } from "./panic.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return [];
|
|
8
|
-
if (Array.isArray(value)) {
|
|
9
|
-
const array = value.map((i) => splitWhitespace(i));
|
|
10
|
-
return array.flat(Number.POSITIVE_INFINITY);
|
|
11
|
-
}
|
|
12
|
-
value = value.trim().split(/\s/);
|
|
13
|
-
return trimArray(value);
|
|
14
|
-
}
|
|
15
|
-
function flush() {
|
|
16
|
-
return new Promise((resolve) => void setTimeout(resolve, 0));
|
|
17
|
-
}
|
|
18
|
-
function sleep(ms) {
|
|
19
|
-
return new Promise((resolve) => void setTimeout(resolve, ms));
|
|
20
|
-
}
|
|
4
|
+
import { splitWhitespace } from "./string.js";
|
|
5
|
+
import { flush, sleep } from "./promise.js";
|
|
21
6
|
function isEmpty(value) {
|
|
22
7
|
if (isNullish(value)) {
|
|
23
8
|
return true;
|
package/dist/promise.cjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function flush() {
|
|
4
|
+
return new Promise((resolve) => void setTimeout(resolve, 0));
|
|
5
|
+
}
|
|
6
|
+
function sleep(ms) {
|
|
7
|
+
return new Promise((resolve) => void setTimeout(resolve, ms));
|
|
8
|
+
}
|
|
9
|
+
exports.flush = flush;
|
|
10
|
+
exports.sleep = sleep;
|
package/dist/promise.js
ADDED
package/dist/string.cjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const array = require("./array.cjs");
|
|
4
|
+
function splitWhitespace(value) {
|
|
5
|
+
if (!value)
|
|
6
|
+
return [];
|
|
7
|
+
if (Array.isArray(value)) {
|
|
8
|
+
const array2 = value.map((i) => splitWhitespace(i));
|
|
9
|
+
return array2.flat(Number.POSITIVE_INFINITY);
|
|
10
|
+
}
|
|
11
|
+
value = value.trim().split(/\s/);
|
|
12
|
+
return array.trimArray(value);
|
|
13
|
+
}
|
|
14
|
+
exports.splitWhitespace = splitWhitespace;
|
package/dist/string.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { trimArray } from "./array.js";
|
|
2
|
+
function splitWhitespace(value) {
|
|
3
|
+
if (!value)
|
|
4
|
+
return [];
|
|
5
|
+
if (Array.isArray(value)) {
|
|
6
|
+
const array = value.map((i) => splitWhitespace(i));
|
|
7
|
+
return array.flat(Number.POSITIVE_INFINITY);
|
|
8
|
+
}
|
|
9
|
+
value = value.trim().split(/\s/);
|
|
10
|
+
return trimArray(value);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
splitWhitespace
|
|
14
|
+
};
|