@oviirup/utils 1.0.7 → 1.0.8
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/index.d.ts → array.d.ts} +2 -2
- package/dist/{array/index.js → array.js} +3 -3
- package/dist/{assertions/index.d.ts → assertions.d.ts} +2 -2
- package/dist/{assertions/index.js → assertions.js} +1 -1
- package/dist/{clsx/index.d.ts → clsx.d.ts} +2 -2
- package/dist/{clsx/index.js → clsx.js} +2 -2
- package/dist/index.d.ts +8 -8
- package/dist/index.js +7 -7
- package/dist/{nanoid/index.d.ts → nanoid.d.ts} +1 -1
- package/dist/{nanoid/index.js → nanoid.js} +1 -1
- package/dist/{number/index.d.ts → number.d.ts} +4 -4
- package/dist/{number/index.js → number.js} +3 -3
- package/dist/object.js +2 -2
- package/dist/picocolors.d.ts +26 -0
- package/dist/picocolors.js +62 -0
- package/dist/{promise/index.d.ts → promise.d.ts} +4 -4
- package/dist/{promise/index.js → promise.js} +3 -3
- package/dist/{string/casing.d.ts → string.d.ts} +16 -2
- package/dist/{string/casing.js → string.js} +36 -3
- package/package.json +13 -13
- package/dist/string/index.d.ts +0 -17
- package/dist/string/index.js +0 -30
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare namespace
|
|
1
|
+
declare namespace array_d_exports {
|
|
2
2
|
export { at, chunk, first, last, move, range, toArray, toFiltered, unique };
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
@@ -66,4 +66,4 @@ declare function move<T>(array: T[], from: number, to: number): T[];
|
|
|
66
66
|
*/
|
|
67
67
|
declare function chunk<T>(array: T[], size: number): T[][];
|
|
68
68
|
//#endregion
|
|
69
|
-
export { at, chunk, first, last, move, range,
|
|
69
|
+
export { at, chunk, first, last, move, range, array_d_exports as t, toArray, toFiltered, unique };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "
|
|
2
|
-
import { isEmptyArray } from "
|
|
1
|
+
import { t as __exportAll } from "./chunk-BYypO7fO.js";
|
|
2
|
+
import { isEmptyArray } from "./assertions.js";
|
|
3
3
|
|
|
4
|
-
//#region src/array
|
|
4
|
+
//#region src/array.ts
|
|
5
5
|
var array_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
at: () => at,
|
|
7
7
|
chunk: () => chunk,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AnyFunction, Dictionary, NegatePredicate, Predicate } from "
|
|
1
|
+
import { AnyFunction, Dictionary, NegatePredicate, Predicate } from "./types.js";
|
|
2
2
|
|
|
3
|
-
//#region src/assertions
|
|
3
|
+
//#region src/assertions.d.ts
|
|
4
4
|
/** Check if given value is a string */
|
|
5
5
|
declare function isString(val: unknown): val is string;
|
|
6
6
|
/** Check if the given value is a number */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isArray, isNumber, isObject, isString } from "
|
|
1
|
+
import { isArray, isNumber, isObject, isString } from "./assertions.js";
|
|
2
2
|
|
|
3
|
-
//#region src/clsx
|
|
3
|
+
//#region src/clsx.ts
|
|
4
4
|
function toClassValue(value) {
|
|
5
5
|
let names = "";
|
|
6
6
|
let temp;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as array_d_exports } from "./array.js";
|
|
2
2
|
import { ClassNameValue } from "./types.js";
|
|
3
|
-
import { isArray, isBrowser, isEmpty, isEmptyArray, isEmptyObject, isFloat, isFunction, isInteger, isNumber, isObject, isRegex, isString, isTruthy, not } from "./assertions
|
|
4
|
-
import { clsx } from "./clsx
|
|
5
|
-
import { charset, nanoid } from "./nanoid
|
|
6
|
-
import { t as
|
|
3
|
+
import { isArray, isBrowser, isEmpty, isEmptyArray, isEmptyObject, isFloat, isFunction, isInteger, isNumber, isObject, isRegex, isString, isTruthy, not } from "./assertions.js";
|
|
4
|
+
import { clsx } from "./clsx.js";
|
|
5
|
+
import { charset, nanoid } from "./nanoid.js";
|
|
6
|
+
import { t as number_d_exports } from "./number.js";
|
|
7
7
|
import { t as object_d_exports } from "./object.js";
|
|
8
|
-
import { t as
|
|
9
|
-
import { t as
|
|
10
|
-
export { ClassNameValue,
|
|
8
|
+
import { t as promise_d_exports } from "./promise.js";
|
|
9
|
+
import { t as string_d_exports } from "./string.js";
|
|
10
|
+
export { ClassNameValue, array_d_exports as array, charset, clsx, isArray, isBrowser, isEmpty, isEmptyArray, isEmptyObject, isFloat, isFunction, isInteger, isNumber, isObject, isRegex, isString, isTruthy, nanoid, not, number_d_exports as number, object_d_exports as object, promise_d_exports as promise, string_d_exports as string };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { isArray, isBrowser, isEmpty, isEmptyArray, isEmptyObject, isFloat, isFunction, isInteger, isNumber, isObject, isRegex, isString, isTruthy, not } from "./assertions
|
|
2
|
-
import { t as array_exports } from "./array
|
|
3
|
-
import { clsx } from "./clsx
|
|
4
|
-
import { charset, nanoid } from "./nanoid
|
|
5
|
-
import { t as number_exports } from "./number
|
|
1
|
+
import { isArray, isBrowser, isEmpty, isEmptyArray, isEmptyObject, isFloat, isFunction, isInteger, isNumber, isObject, isRegex, isString, isTruthy, not } from "./assertions.js";
|
|
2
|
+
import { t as array_exports } from "./array.js";
|
|
3
|
+
import { clsx } from "./clsx.js";
|
|
4
|
+
import { charset, nanoid } from "./nanoid.js";
|
|
5
|
+
import { t as number_exports } from "./number.js";
|
|
6
6
|
import { t as object_exports } from "./object.js";
|
|
7
|
-
import { t as promise_exports } from "./promise
|
|
8
|
-
import { t as string_exports } from "./string
|
|
7
|
+
import { t as promise_exports } from "./promise.js";
|
|
8
|
+
import { t as string_exports } from "./string.js";
|
|
9
9
|
|
|
10
10
|
export { array_exports as array, charset, clsx, isArray, isBrowser, isEmpty, isEmptyArray, isEmptyObject, isFloat, isFunction, isInteger, isNumber, isObject, isRegex, isString, isTruthy, nanoid, not, number_exports as number, object_exports as object, promise_exports as promise, string_exports as string };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AbbreviateOptions, AbbreviationSymbols } from "
|
|
1
|
+
import { AbbreviateOptions, AbbreviationSymbols } from "./types.js";
|
|
2
2
|
|
|
3
|
-
//#region src/number
|
|
4
|
-
declare namespace
|
|
3
|
+
//#region src/number.d.ts
|
|
4
|
+
declare namespace number_d_exports {
|
|
5
5
|
export { AbbreviateOptions, AbbreviationSymbols, abbreviate, clamp, inRange };
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
@@ -29,4 +29,4 @@ declare function clamp(val: number, min: number, max: number): number;
|
|
|
29
29
|
declare function abbreviate(value: number, precision?: number): string;
|
|
30
30
|
declare function abbreviate(value: number, options?: AbbreviateOptions): string;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { type AbbreviateOptions, type AbbreviationSymbols, abbreviate, clamp, inRange,
|
|
32
|
+
export { type AbbreviateOptions, type AbbreviationSymbols, abbreviate, clamp, inRange, number_d_exports as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "
|
|
2
|
-
import { isNumber, isObject } from "
|
|
1
|
+
import { t as __exportAll } from "./chunk-BYypO7fO.js";
|
|
2
|
+
import { isNumber, isObject } from "./assertions.js";
|
|
3
3
|
|
|
4
|
-
//#region src/number
|
|
4
|
+
//#region src/number.ts
|
|
5
5
|
var number_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
abbreviate: () => abbreviate,
|
|
7
7
|
clamp: () => clamp,
|
package/dist/object.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BYypO7fO.js";
|
|
2
|
-
import { isObject } from "./assertions
|
|
3
|
-
import { toArray } from "./array
|
|
2
|
+
import { isObject } from "./assertions.js";
|
|
3
|
+
import { toArray } from "./array.js";
|
|
4
4
|
|
|
5
5
|
//#region src/object.ts
|
|
6
6
|
var object_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region src/picocolors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A recreation of the picocolors library
|
|
4
|
+
*
|
|
5
|
+
* @package picocolors
|
|
6
|
+
* @version 1.1.1
|
|
7
|
+
* @repository https://github.com/alexeyraspopov/picocolors
|
|
8
|
+
*/
|
|
9
|
+
declare const pc: {
|
|
10
|
+
isEnabled: boolean;
|
|
11
|
+
reset: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
12
|
+
bold: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
13
|
+
dim: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
14
|
+
italic: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
15
|
+
underline: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
16
|
+
red: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
17
|
+
green: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
18
|
+
yellow: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
19
|
+
blue: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
20
|
+
magenta: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
21
|
+
cyan: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
22
|
+
white: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
23
|
+
gray: (input: TemplateStringsArray | string, ...args: unknown[]) => string;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { pc };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//#region src/picocolors.ts
|
|
2
|
+
/**
|
|
3
|
+
* A recreation of the picocolors library
|
|
4
|
+
*
|
|
5
|
+
* @package picocolors
|
|
6
|
+
* @version 1.1.1
|
|
7
|
+
* @repository https://github.com/alexeyraspopov/picocolors
|
|
8
|
+
*/
|
|
9
|
+
const p = process || {};
|
|
10
|
+
const argv = p.argv || [];
|
|
11
|
+
const env = p.env || {};
|
|
12
|
+
const isEnabled = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
13
|
+
/** Function wrapper to allow for both normal and tagged template usage */
|
|
14
|
+
function wrapTemplateString(cb) {
|
|
15
|
+
return function(input, ...args) {
|
|
16
|
+
if (Array.isArray(input) && "raw" in input) {
|
|
17
|
+
let str = input[0];
|
|
18
|
+
let i = 0;
|
|
19
|
+
for (const arg of args) str += String(arg) + input[++i];
|
|
20
|
+
return cb(str);
|
|
21
|
+
}
|
|
22
|
+
return cb(String(input));
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function formatter(open, close, replace = open) {
|
|
26
|
+
const format = (input) => {
|
|
27
|
+
if (!isEnabled) return String(input);
|
|
28
|
+
let string = String(input);
|
|
29
|
+
let index = string.indexOf(close, open.length);
|
|
30
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
31
|
+
};
|
|
32
|
+
return wrapTemplateString(format);
|
|
33
|
+
}
|
|
34
|
+
function replaceClose(string, close, replace, index) {
|
|
35
|
+
let result = "";
|
|
36
|
+
let cursor = 0;
|
|
37
|
+
do {
|
|
38
|
+
result += string.substring(cursor, index) + replace;
|
|
39
|
+
cursor = index + close.length;
|
|
40
|
+
index = string.indexOf(close, cursor);
|
|
41
|
+
} while (~index);
|
|
42
|
+
return result + string.substring(cursor);
|
|
43
|
+
}
|
|
44
|
+
const pc = {
|
|
45
|
+
isEnabled,
|
|
46
|
+
reset: formatter("\x1B[0m", "\x1B[0m"),
|
|
47
|
+
bold: formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
48
|
+
dim: formatter("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
49
|
+
italic: formatter("\x1B[3m", "\x1B[23m"),
|
|
50
|
+
underline: formatter("\x1B[4m", "\x1B[24m"),
|
|
51
|
+
red: formatter("\x1B[31m", "\x1B[39m"),
|
|
52
|
+
green: formatter("\x1B[32m", "\x1B[39m"),
|
|
53
|
+
yellow: formatter("\x1B[33m", "\x1B[39m"),
|
|
54
|
+
blue: formatter("\x1B[34m", "\x1B[39m"),
|
|
55
|
+
magenta: formatter("\x1B[35m", "\x1B[39m"),
|
|
56
|
+
cyan: formatter("\x1B[36m", "\x1B[39m"),
|
|
57
|
+
white: formatter("\x1B[37m", "\x1B[39m"),
|
|
58
|
+
gray: formatter("\x1B[90m", "\x1B[39m")
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
//#endregion
|
|
62
|
+
export { pc };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MaybePromise } from "
|
|
1
|
+
import { MaybePromise } from "./types.js";
|
|
2
2
|
|
|
3
|
-
//#region src/promise
|
|
4
|
-
declare namespace
|
|
3
|
+
//#region src/promise.d.ts
|
|
4
|
+
declare namespace promise_d_exports {
|
|
5
5
|
export { retry, sleep, tryCatch };
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
@@ -28,4 +28,4 @@ declare function retry<T>(func: () => Promise<T>, retries: number, delay?: numbe
|
|
|
28
28
|
*/
|
|
29
29
|
declare function tryCatch<T, E = Error>(input: Promise<T> | (() => MaybePromise<T>)): Promise<readonly [Awaited<T>, undefined] | readonly [null, E]>;
|
|
30
30
|
//#endregion
|
|
31
|
-
export { retry, sleep,
|
|
31
|
+
export { retry, sleep, promise_d_exports as t, tryCatch };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "
|
|
2
|
-
import { isNumber } from "
|
|
1
|
+
import { t as __exportAll } from "./chunk-BYypO7fO.js";
|
|
2
|
+
import { isNumber } from "./assertions.js";
|
|
3
3
|
|
|
4
|
-
//#region src/promise
|
|
4
|
+
//#region src/promise.ts
|
|
5
5
|
var promise_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
retry: () => retry,
|
|
7
7
|
sleep: () => sleep,
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
declare namespace string_d_exports {
|
|
2
|
+
export { slash, toCamelCase, toKebabCase, toPascalCase, toSentenceCase, toSnakeCase, toTitleCase, truncate };
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Replace backslash to slash
|
|
6
|
+
* @category String
|
|
7
|
+
*/
|
|
8
|
+
declare function slash(str: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Truncates a string to the specified length, adding "..." if it was longer.
|
|
11
|
+
* @param text The string to truncate
|
|
12
|
+
* @param length Maximum allowed length before truncation (default: 80)
|
|
13
|
+
* @category String
|
|
14
|
+
*/
|
|
15
|
+
declare function truncate(input: string, length?: number): string;
|
|
2
16
|
/**
|
|
3
17
|
* Converts a string to `camelCase`
|
|
4
18
|
* @param str The string to convert
|
|
@@ -42,4 +56,4 @@ declare function toSentenceCase(str: string): string;
|
|
|
42
56
|
*/
|
|
43
57
|
declare function toTitleCase(str: string): string;
|
|
44
58
|
//#endregion
|
|
45
|
-
export { toCamelCase, toKebabCase, toPascalCase, toSentenceCase, toSnakeCase, toTitleCase };
|
|
59
|
+
export { slash, string_d_exports as t, toCamelCase, toKebabCase, toPascalCase, toSentenceCase, toSnakeCase, toTitleCase, truncate };
|
|
@@ -1,9 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __exportAll } from "./chunk-BYypO7fO.js";
|
|
2
|
+
import { isEmpty } from "./assertions.js";
|
|
2
3
|
|
|
3
|
-
//#region src/string
|
|
4
|
+
//#region src/string.ts
|
|
5
|
+
var string_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
slash: () => slash,
|
|
7
|
+
toCamelCase: () => toCamelCase,
|
|
8
|
+
toKebabCase: () => toKebabCase,
|
|
9
|
+
toPascalCase: () => toPascalCase,
|
|
10
|
+
toSentenceCase: () => toSentenceCase,
|
|
11
|
+
toSnakeCase: () => toSnakeCase,
|
|
12
|
+
toTitleCase: () => toTitleCase,
|
|
13
|
+
truncate: () => truncate
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Replace backslash to slash
|
|
17
|
+
* @category String
|
|
18
|
+
*/
|
|
19
|
+
function slash(str) {
|
|
20
|
+
return str.replace(/\\/g, "/");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Truncates a string to the specified length, adding "..." if it was longer.
|
|
24
|
+
* @param text The string to truncate
|
|
25
|
+
* @param length Maximum allowed length before truncation (default: 80)
|
|
26
|
+
* @category String
|
|
27
|
+
*/
|
|
28
|
+
function truncate(input, length = 80) {
|
|
29
|
+
if (!input) return input;
|
|
30
|
+
const text = input.trim();
|
|
31
|
+
const maxLength = Math.max(3, length);
|
|
32
|
+
if (text.length <= maxLength) return text;
|
|
33
|
+
return `${text.slice(0, maxLength - 3)}...`;
|
|
34
|
+
}
|
|
4
35
|
const reWords = /\p{Lu}?\p{Ll}+(?:[''](?:d|ll|m|re|s|t|ve))?(?=[\p{Z}\p{P}\p{S}_-]|\p{Lu}|$)|(?:\p{Lu}|[^\p{Z}\p{N}\p{Emoji_Presentation}\p{L}_-])+(?:[''](?:D|LL|M|RE|S|T|VE))?(?=[\p{Z}\p{P}\p{S}_-]|\p{Lu}(?:\p{Ll}|[^\p{Z}\p{N}\p{Emoji_Presentation}\p{L}_-])|$)|(?:\p{Lu}?[\p{Ll}\p{L}]+(?:[''](?:d|ll|m|re|s|t|ve))?|\p{Lu}+(?:[''](?:D|LL|M|RE|S|T|VE))?|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|\p{Lu})|\d+|\p{Emoji}+)/gu;
|
|
5
36
|
/**
|
|
6
37
|
* Splits a string into an array of words using Unicode-aware matching.
|
|
38
|
+
* @internal
|
|
7
39
|
* @param str The input string to split into words.
|
|
8
40
|
* @returns An array of words found in the input string.
|
|
9
41
|
*/
|
|
@@ -12,6 +44,7 @@ function words(str) {
|
|
|
12
44
|
}
|
|
13
45
|
/**
|
|
14
46
|
* Joins the words in a string with the specified delimiter and converts the result to lowercase.
|
|
47
|
+
* @internal
|
|
15
48
|
* @param str The input string to split into words and join.
|
|
16
49
|
* @param d The delimiter to use when joining the words.
|
|
17
50
|
* @returns The joined string in lowercase.
|
|
@@ -89,4 +122,4 @@ function toTitleCase(str) {
|
|
|
89
122
|
}
|
|
90
123
|
|
|
91
124
|
//#endregion
|
|
92
|
-
export { toCamelCase, toKebabCase, toPascalCase, toSentenceCase, toSnakeCase, toTitleCase };
|
|
125
|
+
export { slash, string_exports as t, toCamelCase, toKebabCase, toPascalCase, toSentenceCase, toSnakeCase, toTitleCase, truncate };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oviirup/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Collection of common JavaScript / TypeScript utilities bt @oviirup",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/oviirup/utils",
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./dist/index.js",
|
|
11
|
-
"./array": "./dist/array
|
|
12
|
-
"./assertions": "./dist/assertions
|
|
13
|
-
"./clsx": "./dist/clsx
|
|
14
|
-
"./nanoid": "./dist/nanoid
|
|
15
|
-
"./number": "./dist/number
|
|
11
|
+
"./array": "./dist/array.js",
|
|
12
|
+
"./assertions": "./dist/assertions.js",
|
|
13
|
+
"./clsx": "./dist/clsx.js",
|
|
14
|
+
"./nanoid": "./dist/nanoid.js",
|
|
15
|
+
"./number": "./dist/number.js",
|
|
16
16
|
"./object": "./dist/object.js",
|
|
17
|
-
"./
|
|
18
|
-
"./
|
|
19
|
-
"./string
|
|
17
|
+
"./picocolors": "./dist/picocolors.js",
|
|
18
|
+
"./promise": "./dist/promise.js",
|
|
19
|
+
"./string": "./dist/string.js",
|
|
20
20
|
"./types": "./dist/types.js",
|
|
21
21
|
"./package.json": "./package.json"
|
|
22
22
|
},
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@biomejs/biome": "^2.
|
|
32
|
+
"@biomejs/biome": "^2.4.8",
|
|
33
33
|
"@changesets/changelog-github": "^0.5.2",
|
|
34
|
-
"@changesets/cli": "^2.
|
|
35
|
-
"@types/bun": "^1.3.
|
|
36
|
-
"lefthook": "^2.1.
|
|
34
|
+
"@changesets/cli": "^2.30.0",
|
|
35
|
+
"@types/bun": "^1.3.11",
|
|
36
|
+
"lefthook": "^2.1.4",
|
|
37
37
|
"tsdown": "^0.20.3",
|
|
38
38
|
"typescript": "^5.9.3"
|
|
39
39
|
},
|
package/dist/string/index.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare namespace index_d_exports {
|
|
2
|
-
export { slash, truncate };
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Replace backslash to slash
|
|
6
|
-
* @category String
|
|
7
|
-
*/
|
|
8
|
-
declare function slash(str: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* Truncates a string to the specified length, adding "..." if it was longer.
|
|
11
|
-
* @param text The string to truncate
|
|
12
|
-
* @param length Maximum allowed length before truncation (default: 80)
|
|
13
|
-
* @category String
|
|
14
|
-
*/
|
|
15
|
-
declare function truncate(input: string, length?: number): string;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { slash, index_d_exports as t, truncate };
|
package/dist/string/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "../chunk-BYypO7fO.js";
|
|
2
|
-
|
|
3
|
-
//#region src/string/index.ts
|
|
4
|
-
var string_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
-
slash: () => slash,
|
|
6
|
-
truncate: () => truncate
|
|
7
|
-
});
|
|
8
|
-
/**
|
|
9
|
-
* Replace backslash to slash
|
|
10
|
-
* @category String
|
|
11
|
-
*/
|
|
12
|
-
function slash(str) {
|
|
13
|
-
return str.replace(/\\/g, "/");
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Truncates a string to the specified length, adding "..." if it was longer.
|
|
17
|
-
* @param text The string to truncate
|
|
18
|
-
* @param length Maximum allowed length before truncation (default: 80)
|
|
19
|
-
* @category String
|
|
20
|
-
*/
|
|
21
|
-
function truncate(input, length = 80) {
|
|
22
|
-
if (!input) return input;
|
|
23
|
-
const text = input.trim();
|
|
24
|
-
const maxLength = Math.max(3, length);
|
|
25
|
-
if (text.length <= maxLength) return text;
|
|
26
|
-
return `${text.slice(0, maxLength - 3)}...`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
//#endregion
|
|
30
|
-
export { slash, string_exports as t, truncate };
|