@tspro/ts-utils-lib 1.5.0 → 1.7.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 +14 -0
- package/README.md +6 -0
- package/dist/index.d.mts +26 -3
- package/dist/index.d.ts +26 -3
- package/dist/index.js +37 -5
- package/dist/index.mjs +37 -5
- package/package.json +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.7.0] - 2025-10-03
|
|
4
|
+
### Added
|
|
5
|
+
- Utils.Obj.hasProperties()
|
|
6
|
+
|
|
7
|
+
## [1.6.0] - 2025-09-16
|
|
8
|
+
### Added
|
|
9
|
+
- Utils.Is.isEmptyArray()
|
|
10
|
+
- Utils.Is.isNonEmptyArray()
|
|
11
|
+
- Utils.Is.isEmptyArrayOrUndefined()
|
|
12
|
+
- Utils.Is.isNonEmptyArrayOrUndefined()
|
|
13
|
+
- Utils.Is.isEmptyStringOrUndefined()
|
|
14
|
+
- Utils.Is.isNonEmptyStringOrUndefined()
|
|
15
|
+
- Utils.Is.isFinite()
|
|
16
|
+
|
|
3
17
|
## [1.5.0] - 2025-09-16
|
|
4
18
|
### Added
|
|
5
19
|
- Utils.Is.isNullish()
|
package/README.md
ADDED
package/dist/index.d.mts
CHANGED
|
@@ -118,10 +118,16 @@ declare function isObject$1(value: unknown): value is Record<string, unknown>;
|
|
|
118
118
|
declare function isObjectOrUndefined(value: unknown): value is Record<string, unknown> | undefined;
|
|
119
119
|
declare function isArray<T>(a: T[] | unknown): a is T[];
|
|
120
120
|
declare function isArrayOrUndefined(value: unknown): value is unknown[] | undefined;
|
|
121
|
+
declare function isEmptyArray<T>(a: T[] | unknown): a is T[];
|
|
122
|
+
declare function isNonEmptyArray<T>(a: T[] | unknown): a is T[];
|
|
123
|
+
declare function isEmptyArrayOrUndefined<T>(a: T[] | unknown): a is T[] | undefined;
|
|
124
|
+
declare function isNonEmptyArrayOrUndefined<T>(a: T[] | unknown): a is T[] | undefined;
|
|
121
125
|
declare function isString(value: unknown): value is string;
|
|
122
126
|
declare function isEmptyString(value: unknown): value is "";
|
|
123
127
|
declare function isNonEmptyString(value: unknown): value is string;
|
|
124
128
|
declare function isStringOrUndefined(value: unknown): value is string | undefined;
|
|
129
|
+
declare function isEmptyStringOrUndefined(value: unknown): value is "" | undefined;
|
|
130
|
+
declare function isNonEmptyStringOrUndefined(value: unknown): value is string | undefined;
|
|
125
131
|
declare function isBoolean(value: unknown): value is boolean;
|
|
126
132
|
declare function isBooleanOrUndefined(value: unknown): value is boolean | undefined;
|
|
127
133
|
declare function isFunction(value: unknown): value is Function;
|
|
@@ -130,6 +136,7 @@ declare function isEnumValue<E extends Record<string, string | number>>(value: u
|
|
|
130
136
|
declare function isEnumValueOrUndefined<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E] | undefined;
|
|
131
137
|
declare function isNumber(value: unknown): value is number;
|
|
132
138
|
declare function isNumberOrUndefined(value: unknown): value is number | undefined;
|
|
139
|
+
declare function isFinite(value: unknown): value is number;
|
|
133
140
|
declare function isInteger$1(n: unknown): n is number;
|
|
134
141
|
declare function isIntegerOrUndefined(n: unknown): n is number | undefined;
|
|
135
142
|
declare function isIntegerEq(value: unknown, compareTo: number): value is number;
|
|
@@ -147,9 +154,13 @@ declare const index$5_isArray: typeof isArray;
|
|
|
147
154
|
declare const index$5_isArrayOrUndefined: typeof isArrayOrUndefined;
|
|
148
155
|
declare const index$5_isBoolean: typeof isBoolean;
|
|
149
156
|
declare const index$5_isBooleanOrUndefined: typeof isBooleanOrUndefined;
|
|
157
|
+
declare const index$5_isEmptyArray: typeof isEmptyArray;
|
|
158
|
+
declare const index$5_isEmptyArrayOrUndefined: typeof isEmptyArrayOrUndefined;
|
|
150
159
|
declare const index$5_isEmptyString: typeof isEmptyString;
|
|
160
|
+
declare const index$5_isEmptyStringOrUndefined: typeof isEmptyStringOrUndefined;
|
|
151
161
|
declare const index$5_isEnumValue: typeof isEnumValue;
|
|
152
162
|
declare const index$5_isEnumValueOrUndefined: typeof isEnumValueOrUndefined;
|
|
163
|
+
declare const index$5_isFinite: typeof isFinite;
|
|
153
164
|
declare const index$5_isFunction: typeof isFunction;
|
|
154
165
|
declare const index$5_isFunctionOrUndefined: typeof isFunctionOrUndefined;
|
|
155
166
|
declare const index$5_isInfinity: typeof isInfinity;
|
|
@@ -162,7 +173,10 @@ declare const index$5_isIntegerLte: typeof isIntegerLte;
|
|
|
162
173
|
declare const index$5_isIntegerOrUndefined: typeof isIntegerOrUndefined;
|
|
163
174
|
declare const index$5_isNaNValue: typeof isNaNValue;
|
|
164
175
|
declare const index$5_isNegInfinity: typeof isNegInfinity;
|
|
176
|
+
declare const index$5_isNonEmptyArray: typeof isNonEmptyArray;
|
|
177
|
+
declare const index$5_isNonEmptyArrayOrUndefined: typeof isNonEmptyArrayOrUndefined;
|
|
165
178
|
declare const index$5_isNonEmptyString: typeof isNonEmptyString;
|
|
179
|
+
declare const index$5_isNonEmptyStringOrUndefined: typeof isNonEmptyStringOrUndefined;
|
|
166
180
|
declare const index$5_isNull: typeof isNull;
|
|
167
181
|
declare const index$5_isNullish: typeof isNullish;
|
|
168
182
|
declare const index$5_isNumber: typeof isNumber;
|
|
@@ -173,7 +187,7 @@ declare const index$5_isString: typeof isString;
|
|
|
173
187
|
declare const index$5_isStringOrUndefined: typeof isStringOrUndefined;
|
|
174
188
|
declare const index$5_isUndefined: typeof isUndefined;
|
|
175
189
|
declare namespace index$5 {
|
|
176
|
-
export { index$5_isArray as isArray, index$5_isArrayOrUndefined as isArrayOrUndefined, index$5_isBoolean as isBoolean, index$5_isBooleanOrUndefined as isBooleanOrUndefined, index$5_isEmptyString as isEmptyString, index$5_isEnumValue as isEnumValue, index$5_isEnumValueOrUndefined as isEnumValueOrUndefined, index$5_isFunction as isFunction, index$5_isFunctionOrUndefined as isFunctionOrUndefined, index$5_isInfinity as isInfinity, isInteger$1 as isInteger, index$5_isIntegerBetween as isIntegerBetween, index$5_isIntegerEq as isIntegerEq, index$5_isIntegerGt as isIntegerGt, index$5_isIntegerGte as isIntegerGte, index$5_isIntegerLt as isIntegerLt, index$5_isIntegerLte as isIntegerLte, index$5_isIntegerOrUndefined as isIntegerOrUndefined, index$5_isNaNValue as isNaNValue, index$5_isNegInfinity as isNegInfinity, index$5_isNonEmptyString as isNonEmptyString, index$5_isNull as isNull, index$5_isNullish as isNullish, index$5_isNumber as isNumber, index$5_isNumberOrUndefined as isNumberOrUndefined, isObject$1 as isObject, index$5_isObjectOrUndefined as isObjectOrUndefined, index$5_isPosInfinity as isPosInfinity, index$5_isString as isString, index$5_isStringOrUndefined as isStringOrUndefined, index$5_isUndefined as isUndefined };
|
|
190
|
+
export { index$5_isArray as isArray, index$5_isArrayOrUndefined as isArrayOrUndefined, index$5_isBoolean as isBoolean, index$5_isBooleanOrUndefined as isBooleanOrUndefined, index$5_isEmptyArray as isEmptyArray, index$5_isEmptyArrayOrUndefined as isEmptyArrayOrUndefined, index$5_isEmptyString as isEmptyString, index$5_isEmptyStringOrUndefined as isEmptyStringOrUndefined, index$5_isEnumValue as isEnumValue, index$5_isEnumValueOrUndefined as isEnumValueOrUndefined, index$5_isFinite as isFinite, index$5_isFunction as isFunction, index$5_isFunctionOrUndefined as isFunctionOrUndefined, index$5_isInfinity as isInfinity, isInteger$1 as isInteger, index$5_isIntegerBetween as isIntegerBetween, index$5_isIntegerEq as isIntegerEq, index$5_isIntegerGt as isIntegerGt, index$5_isIntegerGte as isIntegerGte, index$5_isIntegerLt as isIntegerLt, index$5_isIntegerLte as isIntegerLte, index$5_isIntegerOrUndefined as isIntegerOrUndefined, index$5_isNaNValue as isNaNValue, index$5_isNegInfinity as isNegInfinity, index$5_isNonEmptyArray as isNonEmptyArray, index$5_isNonEmptyArrayOrUndefined as isNonEmptyArrayOrUndefined, index$5_isNonEmptyString as isNonEmptyString, index$5_isNonEmptyStringOrUndefined as isNonEmptyStringOrUndefined, index$5_isNull as isNull, index$5_isNullish as isNullish, index$5_isNumber as isNumber, index$5_isNumberOrUndefined as isNumberOrUndefined, isObject$1 as isObject, index$5_isObjectOrUndefined as isObjectOrUndefined, index$5_isPosInfinity as isPosInfinity, index$5_isString as isString, index$5_isStringOrUndefined as isStringOrUndefined, index$5_isUndefined as isUndefined };
|
|
177
191
|
}
|
|
178
192
|
|
|
179
193
|
declare function getMapKeys<K, V>(map: Map<K, V>): K[];
|
|
@@ -218,11 +232,20 @@ declare namespace index$3 {
|
|
|
218
232
|
export { index$3_calcNormal as calcNormal, index$3_clamp as clamp, index$3_interpolateCoord as interpolateCoord, index$3_interpolateY as interpolateY, index$3_isInteger as isInteger, index$3_linearToDecibels as linearToDecibels, index$3_mod as mod, index$3_romanize as romanize, index$3_sum as sum, index$3_toOrdinalNumber as toOrdinalNumber };
|
|
219
233
|
}
|
|
220
234
|
|
|
221
|
-
declare function isObject(
|
|
235
|
+
declare function isObject(obj: unknown): obj is Record<string, unknown>;
|
|
236
|
+
/**
|
|
237
|
+
* <pre>
|
|
238
|
+
* Usage:
|
|
239
|
+
* hasProperties(obj, ["a", "b"]); // Gives type Record<string, unknown>
|
|
240
|
+
* hasProperties(obj, ["a", "b"] as const); // Gives type Record<"a" | "b", unknown>
|
|
241
|
+
* </pre>
|
|
242
|
+
*/
|
|
243
|
+
declare function hasProperties<T extends readonly string[]>(obj: unknown, props: T | string[]): obj is Record<T[number], unknown>;
|
|
222
244
|
|
|
245
|
+
declare const index$2_hasProperties: typeof hasProperties;
|
|
223
246
|
declare const index$2_isObject: typeof isObject;
|
|
224
247
|
declare namespace index$2 {
|
|
225
|
-
export { index$2_isObject as isObject };
|
|
248
|
+
export { index$2_hasProperties as hasProperties, index$2_isObject as isObject };
|
|
226
249
|
}
|
|
227
250
|
|
|
228
251
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -118,10 +118,16 @@ declare function isObject$1(value: unknown): value is Record<string, unknown>;
|
|
|
118
118
|
declare function isObjectOrUndefined(value: unknown): value is Record<string, unknown> | undefined;
|
|
119
119
|
declare function isArray<T>(a: T[] | unknown): a is T[];
|
|
120
120
|
declare function isArrayOrUndefined(value: unknown): value is unknown[] | undefined;
|
|
121
|
+
declare function isEmptyArray<T>(a: T[] | unknown): a is T[];
|
|
122
|
+
declare function isNonEmptyArray<T>(a: T[] | unknown): a is T[];
|
|
123
|
+
declare function isEmptyArrayOrUndefined<T>(a: T[] | unknown): a is T[] | undefined;
|
|
124
|
+
declare function isNonEmptyArrayOrUndefined<T>(a: T[] | unknown): a is T[] | undefined;
|
|
121
125
|
declare function isString(value: unknown): value is string;
|
|
122
126
|
declare function isEmptyString(value: unknown): value is "";
|
|
123
127
|
declare function isNonEmptyString(value: unknown): value is string;
|
|
124
128
|
declare function isStringOrUndefined(value: unknown): value is string | undefined;
|
|
129
|
+
declare function isEmptyStringOrUndefined(value: unknown): value is "" | undefined;
|
|
130
|
+
declare function isNonEmptyStringOrUndefined(value: unknown): value is string | undefined;
|
|
125
131
|
declare function isBoolean(value: unknown): value is boolean;
|
|
126
132
|
declare function isBooleanOrUndefined(value: unknown): value is boolean | undefined;
|
|
127
133
|
declare function isFunction(value: unknown): value is Function;
|
|
@@ -130,6 +136,7 @@ declare function isEnumValue<E extends Record<string, string | number>>(value: u
|
|
|
130
136
|
declare function isEnumValueOrUndefined<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E] | undefined;
|
|
131
137
|
declare function isNumber(value: unknown): value is number;
|
|
132
138
|
declare function isNumberOrUndefined(value: unknown): value is number | undefined;
|
|
139
|
+
declare function isFinite(value: unknown): value is number;
|
|
133
140
|
declare function isInteger$1(n: unknown): n is number;
|
|
134
141
|
declare function isIntegerOrUndefined(n: unknown): n is number | undefined;
|
|
135
142
|
declare function isIntegerEq(value: unknown, compareTo: number): value is number;
|
|
@@ -147,9 +154,13 @@ declare const index$5_isArray: typeof isArray;
|
|
|
147
154
|
declare const index$5_isArrayOrUndefined: typeof isArrayOrUndefined;
|
|
148
155
|
declare const index$5_isBoolean: typeof isBoolean;
|
|
149
156
|
declare const index$5_isBooleanOrUndefined: typeof isBooleanOrUndefined;
|
|
157
|
+
declare const index$5_isEmptyArray: typeof isEmptyArray;
|
|
158
|
+
declare const index$5_isEmptyArrayOrUndefined: typeof isEmptyArrayOrUndefined;
|
|
150
159
|
declare const index$5_isEmptyString: typeof isEmptyString;
|
|
160
|
+
declare const index$5_isEmptyStringOrUndefined: typeof isEmptyStringOrUndefined;
|
|
151
161
|
declare const index$5_isEnumValue: typeof isEnumValue;
|
|
152
162
|
declare const index$5_isEnumValueOrUndefined: typeof isEnumValueOrUndefined;
|
|
163
|
+
declare const index$5_isFinite: typeof isFinite;
|
|
153
164
|
declare const index$5_isFunction: typeof isFunction;
|
|
154
165
|
declare const index$5_isFunctionOrUndefined: typeof isFunctionOrUndefined;
|
|
155
166
|
declare const index$5_isInfinity: typeof isInfinity;
|
|
@@ -162,7 +173,10 @@ declare const index$5_isIntegerLte: typeof isIntegerLte;
|
|
|
162
173
|
declare const index$5_isIntegerOrUndefined: typeof isIntegerOrUndefined;
|
|
163
174
|
declare const index$5_isNaNValue: typeof isNaNValue;
|
|
164
175
|
declare const index$5_isNegInfinity: typeof isNegInfinity;
|
|
176
|
+
declare const index$5_isNonEmptyArray: typeof isNonEmptyArray;
|
|
177
|
+
declare const index$5_isNonEmptyArrayOrUndefined: typeof isNonEmptyArrayOrUndefined;
|
|
165
178
|
declare const index$5_isNonEmptyString: typeof isNonEmptyString;
|
|
179
|
+
declare const index$5_isNonEmptyStringOrUndefined: typeof isNonEmptyStringOrUndefined;
|
|
166
180
|
declare const index$5_isNull: typeof isNull;
|
|
167
181
|
declare const index$5_isNullish: typeof isNullish;
|
|
168
182
|
declare const index$5_isNumber: typeof isNumber;
|
|
@@ -173,7 +187,7 @@ declare const index$5_isString: typeof isString;
|
|
|
173
187
|
declare const index$5_isStringOrUndefined: typeof isStringOrUndefined;
|
|
174
188
|
declare const index$5_isUndefined: typeof isUndefined;
|
|
175
189
|
declare namespace index$5 {
|
|
176
|
-
export { index$5_isArray as isArray, index$5_isArrayOrUndefined as isArrayOrUndefined, index$5_isBoolean as isBoolean, index$5_isBooleanOrUndefined as isBooleanOrUndefined, index$5_isEmptyString as isEmptyString, index$5_isEnumValue as isEnumValue, index$5_isEnumValueOrUndefined as isEnumValueOrUndefined, index$5_isFunction as isFunction, index$5_isFunctionOrUndefined as isFunctionOrUndefined, index$5_isInfinity as isInfinity, isInteger$1 as isInteger, index$5_isIntegerBetween as isIntegerBetween, index$5_isIntegerEq as isIntegerEq, index$5_isIntegerGt as isIntegerGt, index$5_isIntegerGte as isIntegerGte, index$5_isIntegerLt as isIntegerLt, index$5_isIntegerLte as isIntegerLte, index$5_isIntegerOrUndefined as isIntegerOrUndefined, index$5_isNaNValue as isNaNValue, index$5_isNegInfinity as isNegInfinity, index$5_isNonEmptyString as isNonEmptyString, index$5_isNull as isNull, index$5_isNullish as isNullish, index$5_isNumber as isNumber, index$5_isNumberOrUndefined as isNumberOrUndefined, isObject$1 as isObject, index$5_isObjectOrUndefined as isObjectOrUndefined, index$5_isPosInfinity as isPosInfinity, index$5_isString as isString, index$5_isStringOrUndefined as isStringOrUndefined, index$5_isUndefined as isUndefined };
|
|
190
|
+
export { index$5_isArray as isArray, index$5_isArrayOrUndefined as isArrayOrUndefined, index$5_isBoolean as isBoolean, index$5_isBooleanOrUndefined as isBooleanOrUndefined, index$5_isEmptyArray as isEmptyArray, index$5_isEmptyArrayOrUndefined as isEmptyArrayOrUndefined, index$5_isEmptyString as isEmptyString, index$5_isEmptyStringOrUndefined as isEmptyStringOrUndefined, index$5_isEnumValue as isEnumValue, index$5_isEnumValueOrUndefined as isEnumValueOrUndefined, index$5_isFinite as isFinite, index$5_isFunction as isFunction, index$5_isFunctionOrUndefined as isFunctionOrUndefined, index$5_isInfinity as isInfinity, isInteger$1 as isInteger, index$5_isIntegerBetween as isIntegerBetween, index$5_isIntegerEq as isIntegerEq, index$5_isIntegerGt as isIntegerGt, index$5_isIntegerGte as isIntegerGte, index$5_isIntegerLt as isIntegerLt, index$5_isIntegerLte as isIntegerLte, index$5_isIntegerOrUndefined as isIntegerOrUndefined, index$5_isNaNValue as isNaNValue, index$5_isNegInfinity as isNegInfinity, index$5_isNonEmptyArray as isNonEmptyArray, index$5_isNonEmptyArrayOrUndefined as isNonEmptyArrayOrUndefined, index$5_isNonEmptyString as isNonEmptyString, index$5_isNonEmptyStringOrUndefined as isNonEmptyStringOrUndefined, index$5_isNull as isNull, index$5_isNullish as isNullish, index$5_isNumber as isNumber, index$5_isNumberOrUndefined as isNumberOrUndefined, isObject$1 as isObject, index$5_isObjectOrUndefined as isObjectOrUndefined, index$5_isPosInfinity as isPosInfinity, index$5_isString as isString, index$5_isStringOrUndefined as isStringOrUndefined, index$5_isUndefined as isUndefined };
|
|
177
191
|
}
|
|
178
192
|
|
|
179
193
|
declare function getMapKeys<K, V>(map: Map<K, V>): K[];
|
|
@@ -218,11 +232,20 @@ declare namespace index$3 {
|
|
|
218
232
|
export { index$3_calcNormal as calcNormal, index$3_clamp as clamp, index$3_interpolateCoord as interpolateCoord, index$3_interpolateY as interpolateY, index$3_isInteger as isInteger, index$3_linearToDecibels as linearToDecibels, index$3_mod as mod, index$3_romanize as romanize, index$3_sum as sum, index$3_toOrdinalNumber as toOrdinalNumber };
|
|
219
233
|
}
|
|
220
234
|
|
|
221
|
-
declare function isObject(
|
|
235
|
+
declare function isObject(obj: unknown): obj is Record<string, unknown>;
|
|
236
|
+
/**
|
|
237
|
+
* <pre>
|
|
238
|
+
* Usage:
|
|
239
|
+
* hasProperties(obj, ["a", "b"]); // Gives type Record<string, unknown>
|
|
240
|
+
* hasProperties(obj, ["a", "b"] as const); // Gives type Record<"a" | "b", unknown>
|
|
241
|
+
* </pre>
|
|
242
|
+
*/
|
|
243
|
+
declare function hasProperties<T extends readonly string[]>(obj: unknown, props: T | string[]): obj is Record<T[number], unknown>;
|
|
222
244
|
|
|
245
|
+
declare const index$2_hasProperties: typeof hasProperties;
|
|
223
246
|
declare const index$2_isObject: typeof isObject;
|
|
224
247
|
declare namespace index$2 {
|
|
225
|
-
export { index$2_isObject as isObject };
|
|
248
|
+
export { index$2_hasProperties as hasProperties, index$2_isObject as isObject };
|
|
226
249
|
}
|
|
227
250
|
|
|
228
251
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* TsUtilsLib v1.
|
|
1
|
+
/* TsUtilsLib v1.7.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -707,9 +707,13 @@ __export(is_exports, {
|
|
|
707
707
|
isArrayOrUndefined: () => isArrayOrUndefined,
|
|
708
708
|
isBoolean: () => isBoolean,
|
|
709
709
|
isBooleanOrUndefined: () => isBooleanOrUndefined,
|
|
710
|
+
isEmptyArray: () => isEmptyArray,
|
|
711
|
+
isEmptyArrayOrUndefined: () => isEmptyArrayOrUndefined,
|
|
710
712
|
isEmptyString: () => isEmptyString,
|
|
713
|
+
isEmptyStringOrUndefined: () => isEmptyStringOrUndefined,
|
|
711
714
|
isEnumValue: () => isEnumValue,
|
|
712
715
|
isEnumValueOrUndefined: () => isEnumValueOrUndefined,
|
|
716
|
+
isFinite: () => isFinite2,
|
|
713
717
|
isFunction: () => isFunction,
|
|
714
718
|
isFunctionOrUndefined: () => isFunctionOrUndefined,
|
|
715
719
|
isInfinity: () => isInfinity,
|
|
@@ -723,7 +727,10 @@ __export(is_exports, {
|
|
|
723
727
|
isIntegerOrUndefined: () => isIntegerOrUndefined,
|
|
724
728
|
isNaNValue: () => isNaNValue,
|
|
725
729
|
isNegInfinity: () => isNegInfinity,
|
|
730
|
+
isNonEmptyArray: () => isNonEmptyArray,
|
|
731
|
+
isNonEmptyArrayOrUndefined: () => isNonEmptyArrayOrUndefined,
|
|
726
732
|
isNonEmptyString: () => isNonEmptyString,
|
|
733
|
+
isNonEmptyStringOrUndefined: () => isNonEmptyStringOrUndefined,
|
|
727
734
|
isNull: () => isNull,
|
|
728
735
|
isNullish: () => isNullish,
|
|
729
736
|
isNumber: () => isNumber,
|
|
@@ -756,6 +763,18 @@ function isArray2(a) {
|
|
|
756
763
|
function isArrayOrUndefined(value) {
|
|
757
764
|
return value === void 0 || isArray2(value);
|
|
758
765
|
}
|
|
766
|
+
function isEmptyArray(a) {
|
|
767
|
+
return isArray2(a) && a.length === 0;
|
|
768
|
+
}
|
|
769
|
+
function isNonEmptyArray(a) {
|
|
770
|
+
return isArray2(a) && a.length > 0;
|
|
771
|
+
}
|
|
772
|
+
function isEmptyArrayOrUndefined(a) {
|
|
773
|
+
return isArray2(a) && a.length === 0 || a === void 0;
|
|
774
|
+
}
|
|
775
|
+
function isNonEmptyArrayOrUndefined(a) {
|
|
776
|
+
return isArray2(a) && a.length > 0 || a === void 0;
|
|
777
|
+
}
|
|
759
778
|
function isString(value) {
|
|
760
779
|
return typeof value === "string";
|
|
761
780
|
}
|
|
@@ -768,6 +787,12 @@ function isNonEmptyString(value) {
|
|
|
768
787
|
function isStringOrUndefined(value) {
|
|
769
788
|
return value === void 0 || typeof value === "string";
|
|
770
789
|
}
|
|
790
|
+
function isEmptyStringOrUndefined(value) {
|
|
791
|
+
return typeof value === "string" && value.length === 0 || value === void 0;
|
|
792
|
+
}
|
|
793
|
+
function isNonEmptyStringOrUndefined(value) {
|
|
794
|
+
return typeof value === "string" && value.length > 0 || value === void 0;
|
|
795
|
+
}
|
|
771
796
|
function isBoolean(value) {
|
|
772
797
|
return typeof value === "boolean";
|
|
773
798
|
}
|
|
@@ -792,11 +817,14 @@ function isNumber(value) {
|
|
|
792
817
|
function isNumberOrUndefined(value) {
|
|
793
818
|
return typeof value === "number" || value === void 0;
|
|
794
819
|
}
|
|
820
|
+
function isFinite2(value) {
|
|
821
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
822
|
+
}
|
|
795
823
|
function isInteger2(n) {
|
|
796
|
-
return typeof n === "number" &&
|
|
824
|
+
return typeof n === "number" && isFinite2(n) && n === Math.trunc(n);
|
|
797
825
|
}
|
|
798
826
|
function isIntegerOrUndefined(n) {
|
|
799
|
-
return typeof n === "number" &&
|
|
827
|
+
return typeof n === "number" && isFinite2(n) && n === Math.trunc(n) || n === void 0;
|
|
800
828
|
}
|
|
801
829
|
function isIntegerEq(value, compareTo) {
|
|
802
830
|
return isInteger2(value) && value === compareTo;
|
|
@@ -843,10 +871,14 @@ function getMapKeys(map) {
|
|
|
843
871
|
// src/utils/obj/index.ts
|
|
844
872
|
var obj_exports = {};
|
|
845
873
|
__export(obj_exports, {
|
|
874
|
+
hasProperties: () => hasProperties,
|
|
846
875
|
isObject: () => isObject2
|
|
847
876
|
});
|
|
848
|
-
function isObject2(
|
|
849
|
-
return typeof
|
|
877
|
+
function isObject2(obj) {
|
|
878
|
+
return typeof obj === "object" && obj !== null && !isArray(obj);
|
|
879
|
+
}
|
|
880
|
+
function hasProperties(obj, props) {
|
|
881
|
+
return isObject2(obj) && props.every((p) => p in obj);
|
|
850
882
|
}
|
|
851
883
|
|
|
852
884
|
// src/utils/str/index.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* TsUtilsLib v1.
|
|
1
|
+
/* TsUtilsLib v1.7.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __export = (target, all) => {
|
|
@@ -680,9 +680,13 @@ __export(is_exports, {
|
|
|
680
680
|
isArrayOrUndefined: () => isArrayOrUndefined,
|
|
681
681
|
isBoolean: () => isBoolean,
|
|
682
682
|
isBooleanOrUndefined: () => isBooleanOrUndefined,
|
|
683
|
+
isEmptyArray: () => isEmptyArray,
|
|
684
|
+
isEmptyArrayOrUndefined: () => isEmptyArrayOrUndefined,
|
|
683
685
|
isEmptyString: () => isEmptyString,
|
|
686
|
+
isEmptyStringOrUndefined: () => isEmptyStringOrUndefined,
|
|
684
687
|
isEnumValue: () => isEnumValue,
|
|
685
688
|
isEnumValueOrUndefined: () => isEnumValueOrUndefined,
|
|
689
|
+
isFinite: () => isFinite2,
|
|
686
690
|
isFunction: () => isFunction,
|
|
687
691
|
isFunctionOrUndefined: () => isFunctionOrUndefined,
|
|
688
692
|
isInfinity: () => isInfinity,
|
|
@@ -696,7 +700,10 @@ __export(is_exports, {
|
|
|
696
700
|
isIntegerOrUndefined: () => isIntegerOrUndefined,
|
|
697
701
|
isNaNValue: () => isNaNValue,
|
|
698
702
|
isNegInfinity: () => isNegInfinity,
|
|
703
|
+
isNonEmptyArray: () => isNonEmptyArray,
|
|
704
|
+
isNonEmptyArrayOrUndefined: () => isNonEmptyArrayOrUndefined,
|
|
699
705
|
isNonEmptyString: () => isNonEmptyString,
|
|
706
|
+
isNonEmptyStringOrUndefined: () => isNonEmptyStringOrUndefined,
|
|
700
707
|
isNull: () => isNull,
|
|
701
708
|
isNullish: () => isNullish,
|
|
702
709
|
isNumber: () => isNumber,
|
|
@@ -729,6 +736,18 @@ function isArray2(a) {
|
|
|
729
736
|
function isArrayOrUndefined(value) {
|
|
730
737
|
return value === void 0 || isArray2(value);
|
|
731
738
|
}
|
|
739
|
+
function isEmptyArray(a) {
|
|
740
|
+
return isArray2(a) && a.length === 0;
|
|
741
|
+
}
|
|
742
|
+
function isNonEmptyArray(a) {
|
|
743
|
+
return isArray2(a) && a.length > 0;
|
|
744
|
+
}
|
|
745
|
+
function isEmptyArrayOrUndefined(a) {
|
|
746
|
+
return isArray2(a) && a.length === 0 || a === void 0;
|
|
747
|
+
}
|
|
748
|
+
function isNonEmptyArrayOrUndefined(a) {
|
|
749
|
+
return isArray2(a) && a.length > 0 || a === void 0;
|
|
750
|
+
}
|
|
732
751
|
function isString(value) {
|
|
733
752
|
return typeof value === "string";
|
|
734
753
|
}
|
|
@@ -741,6 +760,12 @@ function isNonEmptyString(value) {
|
|
|
741
760
|
function isStringOrUndefined(value) {
|
|
742
761
|
return value === void 0 || typeof value === "string";
|
|
743
762
|
}
|
|
763
|
+
function isEmptyStringOrUndefined(value) {
|
|
764
|
+
return typeof value === "string" && value.length === 0 || value === void 0;
|
|
765
|
+
}
|
|
766
|
+
function isNonEmptyStringOrUndefined(value) {
|
|
767
|
+
return typeof value === "string" && value.length > 0 || value === void 0;
|
|
768
|
+
}
|
|
744
769
|
function isBoolean(value) {
|
|
745
770
|
return typeof value === "boolean";
|
|
746
771
|
}
|
|
@@ -765,11 +790,14 @@ function isNumber(value) {
|
|
|
765
790
|
function isNumberOrUndefined(value) {
|
|
766
791
|
return typeof value === "number" || value === void 0;
|
|
767
792
|
}
|
|
793
|
+
function isFinite2(value) {
|
|
794
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
795
|
+
}
|
|
768
796
|
function isInteger2(n) {
|
|
769
|
-
return typeof n === "number" &&
|
|
797
|
+
return typeof n === "number" && isFinite2(n) && n === Math.trunc(n);
|
|
770
798
|
}
|
|
771
799
|
function isIntegerOrUndefined(n) {
|
|
772
|
-
return typeof n === "number" &&
|
|
800
|
+
return typeof n === "number" && isFinite2(n) && n === Math.trunc(n) || n === void 0;
|
|
773
801
|
}
|
|
774
802
|
function isIntegerEq(value, compareTo) {
|
|
775
803
|
return isInteger2(value) && value === compareTo;
|
|
@@ -816,10 +844,14 @@ function getMapKeys(map) {
|
|
|
816
844
|
// src/utils/obj/index.ts
|
|
817
845
|
var obj_exports = {};
|
|
818
846
|
__export(obj_exports, {
|
|
847
|
+
hasProperties: () => hasProperties,
|
|
819
848
|
isObject: () => isObject2
|
|
820
849
|
});
|
|
821
|
-
function isObject2(
|
|
822
|
-
return typeof
|
|
850
|
+
function isObject2(obj) {
|
|
851
|
+
return typeof obj === "object" && obj !== null && !isArray(obj);
|
|
852
|
+
}
|
|
853
|
+
function hasProperties(obj, props) {
|
|
854
|
+
return isObject2(obj) && props.every((p) => p in obj);
|
|
823
855
|
}
|
|
824
856
|
|
|
825
857
|
// src/utils/str/index.ts
|
package/package.json
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tspro/ts-utils-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"author": "PahkaSoft",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
7
|
-
"
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/pahkasoft/ts-utils-lib.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/pahkasoft/ts-utils-lib/issues/new/choose"
|
|
13
|
+
},
|
|
14
|
+
"description": "Useful library of typescript classes, modules and functions.",
|
|
8
15
|
"types": "dist/index.d.ts",
|
|
9
16
|
"main": "dist/index.js",
|
|
10
17
|
"module": "dist/index.mjs",
|