@tspro/ts-utils-lib 3.1.1 → 3.3.0
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/CHANGELOG.md +11 -0
- package/README.md +6 -26
- package/dist/index.d.ts +16 -11
- package/dist/index.es5.iife.js +1 -1
- package/dist/index.es5.polyfilled.iife.js +1 -1
- package/dist/index.js +64 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +64 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## [3.3.0] - 2026-01-12
|
|
3
|
+
## Changed
|
|
4
|
+
- Loosen some Utils.Dom function arguments from HTMLElement to Element.
|
|
5
|
+
- Utils.Dom.addClass() and removeClass() accept multiple class names using variadic arg.
|
|
6
|
+
|
|
7
|
+
## [3.2.0] - 2026-01-??
|
|
8
|
+
## Added
|
|
9
|
+
- Utils.Str.trimStart()
|
|
10
|
+
- Utils.Str.trimEnd()
|
|
11
|
+
- Utils.Str.trim()
|
|
12
|
+
|
|
2
13
|
## [3.1.1] - 2026-01-08
|
|
3
14
|
## Fixed
|
|
4
15
|
- CallTracker.
|
package/README.md
CHANGED
|
@@ -14,6 +14,12 @@ lib is written by AI.
|
|
|
14
14
|
|
|
15
15
|
Homepage contains TS Docs/API Reference.
|
|
16
16
|
|
|
17
|
+
## Version 3.x Info
|
|
18
|
+
Version `3.0.0` changed `Device`.
|
|
19
|
+
|
|
20
|
+
Version `3.1.0` added invalid `CallTracker`.
|
|
21
|
+
Use version `3.1.1` with correct `CallTracker` instead.
|
|
22
|
+
|
|
17
23
|
## Install
|
|
18
24
|
`npm install @tspro/ts-utils-lib`
|
|
19
25
|
|
|
@@ -50,29 +56,3 @@ const map = new UniMap();
|
|
|
50
56
|
console.log(Utils.Str.stringify(map));
|
|
51
57
|
</script>
|
|
52
58
|
```
|
|
53
|
-
|
|
54
|
-
## Version 2 Update
|
|
55
|
-
|
|
56
|
-
Made major update because
|
|
57
|
-
- Wanted to remove deprecated renamed or obsoloted stuff.
|
|
58
|
-
- Wanted to upgrade Assert and Guard namespaces.
|
|
59
|
-
- Version 1 had already grown a bit.
|
|
60
|
-
|
|
61
|
-
Deprecations and replacements
|
|
62
|
-
- `Vec2` -> `Vec`
|
|
63
|
-
- `Map1` -> `UniMap`
|
|
64
|
-
- `Map2` -> `BiMap`
|
|
65
|
-
- `Map3` -> `TriMap`
|
|
66
|
-
- `Set1` -> `ValueSet`
|
|
67
|
-
- `DeepSet` -> `ValueSet.createDeep()`
|
|
68
|
-
- `DivRect` -> `AnchoredRect`
|
|
69
|
-
- `Utils.Is.isX...` -> `Guard.isX...`
|
|
70
|
-
|
|
71
|
-
Additions
|
|
72
|
-
- `Rect`
|
|
73
|
-
- `Guard.is*` - intriduced more guards.
|
|
74
|
-
- `Assert.is*` - introduced more assertions.
|
|
75
|
-
- `Utils.Str.stringify(val)` - generic format-anything.
|
|
76
|
-
|
|
77
|
-
There are some other changes (e.g. `Guard.isOddNumber()` -> `Guard.isOdd()`
|
|
78
|
-
and so on), but most the stuff is compatible with 1.x.
|
package/dist/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare namespace index$8 {
|
|
|
22
22
|
type ErrorConstructor = new (msg: string) => Error;
|
|
23
23
|
declare function setErrorClass(errorClass?: ErrorConstructor): void;
|
|
24
24
|
declare function assert<T>(condition: T, msg?: string): void;
|
|
25
|
-
declare function require<T>(val: T | null | undefined, msg?: string): T;
|
|
25
|
+
declare function require$1<T>(val: T | null | undefined, msg?: string): T;
|
|
26
26
|
declare function requireDefined<T>(val: T | undefined, msg?: string): T;
|
|
27
27
|
declare function requireElement<E>(index: unknown, array: ReadonlyArray<E>, msg?: string): E;
|
|
28
28
|
declare function fail(msg?: string): never;
|
|
@@ -108,12 +108,11 @@ declare function doesNotThrow$1(throwTestFn: () => void, msg?: string): true;
|
|
|
108
108
|
type index$7_ErrorConstructor = ErrorConstructor;
|
|
109
109
|
declare const index$7_assert: typeof assert;
|
|
110
110
|
declare const index$7_fail: typeof fail;
|
|
111
|
-
declare const index$7_require: typeof require;
|
|
112
111
|
declare const index$7_requireDefined: typeof requireDefined;
|
|
113
112
|
declare const index$7_requireElement: typeof requireElement;
|
|
114
113
|
declare const index$7_setErrorClass: typeof setErrorClass;
|
|
115
114
|
declare namespace index$7 {
|
|
116
|
-
export { type index$7_ErrorConstructor as ErrorConstructor, index$7_assert as assert, doesNotThrow$1 as doesNotThrow, doesThrow$1 as doesThrow, index$7_fail as fail, isArray$1 as isArray, isArrayOrUndefined$1 as isArrayOrUndefined, isBigInt$1 as isBigInt, isBoolean$1 as isBoolean, isBooleanOrUndefined$1 as isBooleanOrUndefined, isDeepEqual$1 as isDeepEqual, isDefined$1 as isDefined, isEmptyArray$1 as isEmptyArray, isEmptyArrayOrUndefined$1 as isEmptyArrayOrUndefined, isEmptyObject$1 as isEmptyObject, isEmptyString$1 as isEmptyString, isEmptyStringOrUndefined$1 as isEmptyStringOrUndefined, isEnumValue$1 as isEnumValue, isEnumValueOrUndefined$1 as isEnumValueOrUndefined, isEven$1 as isEven, isFalse$1 as isFalse, isFalseOrUndefined$1 as isFalseOrUndefined, isFinite$1 as isFinite, isFloat$1 as isFloat, isFunction$1 as isFunction, isFunctionOrUndefined$1 as isFunctionOrUndefined, isIncluded$1 as isIncluded, isIndex$1 as isIndex, isInfinity$1 as isInfinity, isInteger$1 as isInteger, isIntegerBetween$1 as isIntegerBetween, isIntegerBetweenExclusive$1 as isIntegerBetweenExclusive, isIntegerEq$1 as isIntegerEq, isIntegerGt$1 as isIntegerGt, isIntegerGte$1 as isIntegerGte, isIntegerLt$1 as isIntegerLt, isIntegerLte$1 as isIntegerLte, isIntegerOrUndefined$1 as isIntegerOrUndefined, isMultipleOf$1 as isMultipleOf, isNaNValue$1 as isNaNValue, isNeg$1 as isNeg, isNegInfinity$1 as isNegInfinity, isNegZero$1 as isNegZero, isNonEmptyArray$1 as isNonEmptyArray, isNonEmptyArrayOrUndefined$1 as isNonEmptyArrayOrUndefined, isNonEmptyString$1 as isNonEmptyString, isNonEmptyStringOrUndefined$1 as isNonEmptyStringOrUndefined, isNonNeg$1 as isNonNeg, isNonNull$1 as isNonNull, isNonPos$1 as isNonPos, isNull$1 as isNull, isNullish$1 as isNullish, isNumber$1 as isNumber, isNumberBetween$1 as isNumberBetween, isNumberBetweenExclusive$1 as isNumberBetweenExclusive, isNumberEq$1 as isNumberEq, isNumberGt$1 as isNumberGt, isNumberGte$1 as isNumberGte, isNumberLt$1 as isNumberLt, isNumberLte$1 as isNumberLte, isNumberOrUndefined$1 as isNumberOrUndefined, isNumericString$1 as isNumericString, isObject$1 as isObject, isObjectOrUndefined$1 as isObjectOrUndefined, isOdd$1 as isOdd, isPlainObject$1 as isPlainObject, isPos$1 as isPos, isPosInfinity$1 as isPosInfinity, isPosZero$1 as isPosZero, isPowerOfTwo$1 as isPowerOfTwo, isSafeInteger$1 as isSafeInteger, isSafeNumber$1 as isSafeNumber, isStrictEqual$1 as isStrictEqual, isString$1 as isString, isStringOrUndefined$1 as isStringOrUndefined, isTrue$1 as isTrue, isTrueOrUndefined$1 as isTrueOrUndefined, isTypedObject$1 as isTypedObject, isUndefined$1 as isUndefined, isZero$1 as isZero,
|
|
115
|
+
export { type index$7_ErrorConstructor as ErrorConstructor, index$7_assert as assert, doesNotThrow$1 as doesNotThrow, doesThrow$1 as doesThrow, index$7_fail as fail, isArray$1 as isArray, isArrayOrUndefined$1 as isArrayOrUndefined, isBigInt$1 as isBigInt, isBoolean$1 as isBoolean, isBooleanOrUndefined$1 as isBooleanOrUndefined, isDeepEqual$1 as isDeepEqual, isDefined$1 as isDefined, isEmptyArray$1 as isEmptyArray, isEmptyArrayOrUndefined$1 as isEmptyArrayOrUndefined, isEmptyObject$1 as isEmptyObject, isEmptyString$1 as isEmptyString, isEmptyStringOrUndefined$1 as isEmptyStringOrUndefined, isEnumValue$1 as isEnumValue, isEnumValueOrUndefined$1 as isEnumValueOrUndefined, isEven$1 as isEven, isFalse$1 as isFalse, isFalseOrUndefined$1 as isFalseOrUndefined, isFinite$1 as isFinite, isFloat$1 as isFloat, isFunction$1 as isFunction, isFunctionOrUndefined$1 as isFunctionOrUndefined, isIncluded$1 as isIncluded, isIndex$1 as isIndex, isInfinity$1 as isInfinity, isInteger$1 as isInteger, isIntegerBetween$1 as isIntegerBetween, isIntegerBetweenExclusive$1 as isIntegerBetweenExclusive, isIntegerEq$1 as isIntegerEq, isIntegerGt$1 as isIntegerGt, isIntegerGte$1 as isIntegerGte, isIntegerLt$1 as isIntegerLt, isIntegerLte$1 as isIntegerLte, isIntegerOrUndefined$1 as isIntegerOrUndefined, isMultipleOf$1 as isMultipleOf, isNaNValue$1 as isNaNValue, isNeg$1 as isNeg, isNegInfinity$1 as isNegInfinity, isNegZero$1 as isNegZero, isNonEmptyArray$1 as isNonEmptyArray, isNonEmptyArrayOrUndefined$1 as isNonEmptyArrayOrUndefined, isNonEmptyString$1 as isNonEmptyString, isNonEmptyStringOrUndefined$1 as isNonEmptyStringOrUndefined, isNonNeg$1 as isNonNeg, isNonNull$1 as isNonNull, isNonPos$1 as isNonPos, isNull$1 as isNull, isNullish$1 as isNullish, isNumber$1 as isNumber, isNumberBetween$1 as isNumberBetween, isNumberBetweenExclusive$1 as isNumberBetweenExclusive, isNumberEq$1 as isNumberEq, isNumberGt$1 as isNumberGt, isNumberGte$1 as isNumberGte, isNumberLt$1 as isNumberLt, isNumberLte$1 as isNumberLte, isNumberOrUndefined$1 as isNumberOrUndefined, isNumericString$1 as isNumericString, isObject$1 as isObject, isObjectOrUndefined$1 as isObjectOrUndefined, isOdd$1 as isOdd, isPlainObject$1 as isPlainObject, isPos$1 as isPos, isPosInfinity$1 as isPosInfinity, isPosZero$1 as isPosZero, isPowerOfTwo$1 as isPowerOfTwo, isSafeInteger$1 as isSafeInteger, isSafeNumber$1 as isSafeNumber, isStrictEqual$1 as isStrictEqual, isString$1 as isString, isStringOrUndefined$1 as isStringOrUndefined, isTrue$1 as isTrue, isTrueOrUndefined$1 as isTrueOrUndefined, isTypedObject$1 as isTypedObject, isUndefined$1 as isUndefined, isZero$1 as isZero, require$1 as require, index$7_requireDefined as requireDefined, index$7_requireElement as requireElement, index$7_setErrorClass as setErrorClass };
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
/**
|
|
@@ -431,9 +430,9 @@ interface CSSProperties {
|
|
|
431
430
|
width?: string | number;
|
|
432
431
|
height?: string | number;
|
|
433
432
|
}
|
|
434
|
-
declare function hasClass(el:
|
|
435
|
-
declare function addClass(el:
|
|
436
|
-
declare function removeClass(el:
|
|
433
|
+
declare function hasClass(el: Element, className: string): boolean;
|
|
434
|
+
declare function addClass(el: Element, ...className: string[]): void;
|
|
435
|
+
declare function removeClass(el: Element, ...className: string[]): void;
|
|
437
436
|
declare function setOffset(el: HTMLElement, left: number, top: number, unit?: string): void;
|
|
438
437
|
declare function getOffset(el: HTMLElement): {
|
|
439
438
|
left: number;
|
|
@@ -443,12 +442,12 @@ declare function getWidth(el: HTMLElement | Window): number;
|
|
|
443
442
|
declare function setWidth(el: HTMLElement, val: number): void;
|
|
444
443
|
declare function getHeight(el: HTMLElement | Window): number;
|
|
445
444
|
declare function setHeight(el: HTMLElement, val: number): void;
|
|
446
|
-
declare function appendTo(el:
|
|
447
|
-
declare function removeFromParent(el:
|
|
445
|
+
declare function appendTo(el: Element | SVGElement, to: Element | SVGElement): void;
|
|
446
|
+
declare function removeFromParent(el: Element | SVGElement): void;
|
|
448
447
|
declare function setVisibility(el: HTMLElement | SVGElement, visible: boolean): void;
|
|
449
448
|
declare function setRect(el: HTMLElement, left: number, top: number, width: number, height: number, unit?: string): void;
|
|
450
|
-
declare function getButton(btn:
|
|
451
|
-
declare function getCanvas(canvas:
|
|
449
|
+
declare function getButton(btn: Element | string): HTMLButtonElement | undefined;
|
|
450
|
+
declare function getCanvas(canvas: Element | string): HTMLCanvasElement | undefined;
|
|
452
451
|
declare function getPadding(style?: CSSProperties): {
|
|
453
452
|
top: number;
|
|
454
453
|
right: number;
|
|
@@ -650,6 +649,9 @@ declare function splitByStrings(str: string, ...splitters: string[]): string[];
|
|
|
650
649
|
* @returns An array of string segments split at any of the given characters.
|
|
651
650
|
*/
|
|
652
651
|
declare function splitByChars(str: string, splitters: string): string[];
|
|
652
|
+
declare function trimStart(str: string, ...chars: string[]): string;
|
|
653
|
+
declare function trimEnd(str: string, ...chars: string[]): string;
|
|
654
|
+
declare function trim(str: string, ...chars: string[]): string;
|
|
653
655
|
|
|
654
656
|
declare const index$1_charCount: typeof charCount;
|
|
655
657
|
declare const index$1_chunkString: typeof chunkString;
|
|
@@ -664,8 +666,11 @@ declare const index$1_splitByChars: typeof splitByChars;
|
|
|
664
666
|
declare const index$1_splitByStrings: typeof splitByStrings;
|
|
665
667
|
declare const index$1_stringify: typeof stringify;
|
|
666
668
|
declare const index$1_toCharArray: typeof toCharArray;
|
|
669
|
+
declare const index$1_trim: typeof trim;
|
|
670
|
+
declare const index$1_trimEnd: typeof trimEnd;
|
|
671
|
+
declare const index$1_trimStart: typeof trimStart;
|
|
667
672
|
declare namespace index$1 {
|
|
668
|
-
export { index$1_charCount as charCount, index$1_chunkString as chunkString, index$1_insertAt as insertAt, index$1_isString as isString, index$1_makeSentenceFromPascal as makeSentenceFromPascal, index$1_removeAt as removeAt, index$1_repeatString as repeatString, index$1_replaceAt as replaceAt, index$1_splitByCaps as splitByCaps, index$1_splitByChars as splitByChars, index$1_splitByStrings as splitByStrings, index$1_stringify as stringify, index$1_toCharArray as toCharArray };
|
|
673
|
+
export { index$1_charCount as charCount, index$1_chunkString as chunkString, index$1_insertAt as insertAt, index$1_isString as isString, index$1_makeSentenceFromPascal as makeSentenceFromPascal, index$1_removeAt as removeAt, index$1_repeatString as repeatString, index$1_replaceAt as replaceAt, index$1_splitByCaps as splitByCaps, index$1_splitByChars as splitByChars, index$1_splitByStrings as splitByStrings, index$1_stringify as stringify, index$1_toCharArray as toCharArray, index$1_trim as trim, index$1_trimEnd as trimEnd, index$1_trimStart as trimStart };
|
|
669
674
|
}
|
|
670
675
|
|
|
671
676
|
declare namespace index {
|