@tb-dev/utils 2.0.0 → 2.0.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/array.d.ts +2 -0
- package/dist/panic.d.ts +1 -0
- package/dist/promise.d.ts +1 -0
- package/dist/string.d.ts +10 -0
- package/package.json +7 -7
package/dist/array.d.ts
CHANGED
|
@@ -2,5 +2,7 @@ import { MaybeArray, Nullish } from './types';
|
|
|
2
2
|
|
|
3
3
|
/** Pushes an item to the array if it doesn't exist, otherwise updates it. */
|
|
4
4
|
export declare function upsert<T>(array: T[], item: T, predicate: (value: T) => boolean): void;
|
|
5
|
+
/** Converts the item to an array if it isn't already. */
|
|
5
6
|
export declare function toArray<T>(item?: Nullish<MaybeArray<T>>): T[];
|
|
7
|
+
/** Trims each string in the array, removing any empty strings. */
|
|
6
8
|
export declare function trimArray(array: string[]): string[];
|
package/dist/panic.d.ts
CHANGED
package/dist/promise.d.ts
CHANGED
package/dist/string.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import { Nullish } from './types';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Splits a string or an array of strings (recursively) by whitespace.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* splitWhitespace('a b c'); // ['a', 'b', 'c']
|
|
9
|
+
* splitWhitespace(['a b', 'c']); // ['a', 'b', 'c']
|
|
10
|
+
* splitWhitespace(['a ', ['b', ['c d']]]); // ['a', 'b', 'c', 'd']
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
3
13
|
export declare function splitWhitespace(value: Nullish<string | string[]>): string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tb-dev/utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "TypeScript utils",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"*.{?(c|m)@(j|t)s,vue}": "pnpm run lint"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@tb-dev/eslint-config": "^3.8.
|
|
31
|
-
"@types/node": "^20.14.
|
|
30
|
+
"@tb-dev/eslint-config": "^3.8.10",
|
|
31
|
+
"@types/node": "^20.14.11",
|
|
32
32
|
"eslint": "^8.57.0",
|
|
33
|
-
"husky": "^9.0
|
|
33
|
+
"husky": "^9.1.0",
|
|
34
34
|
"lint-staged": "^15.2.7",
|
|
35
|
-
"prettier": "^3.3.
|
|
35
|
+
"prettier": "^3.3.3",
|
|
36
36
|
"tslib": "^2.6.3",
|
|
37
37
|
"typedoc": "^0.26.4",
|
|
38
|
-
"typedoc-plugin-mdn-links": "^3.2.
|
|
38
|
+
"typedoc-plugin-mdn-links": "^3.2.4",
|
|
39
39
|
"typescript": "^5.5.3",
|
|
40
|
-
"vite": "^5.3.
|
|
40
|
+
"vite": "^5.3.4",
|
|
41
41
|
"vite-plugin-dts": "^3.9.1"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|