@tspro/ts-utils-lib 1.3.0 → 1.5.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 CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.5.0] - 2025-09-16
4
+ ### Added
5
+ - Utils.Is.isNullish()
6
+ - Utils.Is.isEmptyString()
7
+ - Utils.Is.isNonEmptyString()
8
+ - Utils.Is.isIntegerOrUndefined()
9
+ - Utils.Is.isIntegerBetween()
10
+ - Utils.Is.isNaNValue()
11
+ - Utils.Is.isInfinity()
12
+ - Utils.Is.isPosInfinity()
13
+ - Utils.Is.isNegInfinity()
14
+
15
+ ## [1.4.0] - 2025-09-16
16
+ ### Added
17
+ - Utils.Str.charCount(str, ch)
18
+
3
19
  ## [1.3.0] - 2025-07-18
4
20
  ### Added
5
21
  - Utils.Is
package/dist/index.d.mts CHANGED
@@ -113,49 +113,67 @@ declare namespace index$6 {
113
113
 
114
114
  declare function isUndefined(value: unknown): value is undefined;
115
115
  declare function isNull(value: unknown): value is null;
116
+ declare function isNullish(value: unknown): value is null | undefined;
116
117
  declare function isObject$1(value: unknown): value is Record<string, unknown>;
117
118
  declare function isObjectOrUndefined(value: unknown): value is Record<string, unknown> | undefined;
118
119
  declare function isArray<T>(a: T[] | unknown): a is T[];
119
120
  declare function isArrayOrUndefined(value: unknown): value is unknown[] | undefined;
120
121
  declare function isString(value: unknown): value is string;
122
+ declare function isEmptyString(value: unknown): value is "";
123
+ declare function isNonEmptyString(value: unknown): value is string;
121
124
  declare function isStringOrUndefined(value: unknown): value is string | undefined;
122
125
  declare function isBoolean(value: unknown): value is boolean;
123
126
  declare function isBooleanOrUndefined(value: unknown): value is boolean | undefined;
124
127
  declare function isFunction(value: unknown): value is Function;
125
128
  declare function isFunctionOrUndefined(value: unknown): value is Function | undefined;
126
- declare function isNumber(value: unknown): value is number;
127
- declare function isNumberOrUndefined(value: unknown): value is number | undefined;
128
129
  declare function isEnumValue<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E];
129
130
  declare function isEnumValueOrUndefined<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E] | undefined;
131
+ declare function isNumber(value: unknown): value is number;
132
+ declare function isNumberOrUndefined(value: unknown): value is number | undefined;
130
133
  declare function isInteger$1(n: unknown): n is number;
134
+ declare function isIntegerOrUndefined(n: unknown): n is number | undefined;
131
135
  declare function isIntegerEq(value: unknown, compareTo: number): value is number;
132
136
  declare function isIntegerGt(value: unknown, compareTo: number): value is number;
133
137
  declare function isIntegerGte(value: unknown, compareTo: number): value is number;
134
138
  declare function isIntegerLt(value: unknown, compareTo: number): value is number;
135
139
  declare function isIntegerLte(value: unknown, compareTo: number): value is number;
140
+ declare function isIntegerBetween(value: unknown, min: number, max: number): value is number;
141
+ declare function isNaNValue(value: unknown): value is number;
142
+ declare function isInfinity(value: unknown): value is number;
143
+ declare function isPosInfinity(value: unknown): value is number;
144
+ declare function isNegInfinity(value: unknown): value is number;
136
145
 
137
146
  declare const index$5_isArray: typeof isArray;
138
147
  declare const index$5_isArrayOrUndefined: typeof isArrayOrUndefined;
139
148
  declare const index$5_isBoolean: typeof isBoolean;
140
149
  declare const index$5_isBooleanOrUndefined: typeof isBooleanOrUndefined;
150
+ declare const index$5_isEmptyString: typeof isEmptyString;
141
151
  declare const index$5_isEnumValue: typeof isEnumValue;
142
152
  declare const index$5_isEnumValueOrUndefined: typeof isEnumValueOrUndefined;
143
153
  declare const index$5_isFunction: typeof isFunction;
144
154
  declare const index$5_isFunctionOrUndefined: typeof isFunctionOrUndefined;
155
+ declare const index$5_isInfinity: typeof isInfinity;
156
+ declare const index$5_isIntegerBetween: typeof isIntegerBetween;
145
157
  declare const index$5_isIntegerEq: typeof isIntegerEq;
146
158
  declare const index$5_isIntegerGt: typeof isIntegerGt;
147
159
  declare const index$5_isIntegerGte: typeof isIntegerGte;
148
160
  declare const index$5_isIntegerLt: typeof isIntegerLt;
149
161
  declare const index$5_isIntegerLte: typeof isIntegerLte;
162
+ declare const index$5_isIntegerOrUndefined: typeof isIntegerOrUndefined;
163
+ declare const index$5_isNaNValue: typeof isNaNValue;
164
+ declare const index$5_isNegInfinity: typeof isNegInfinity;
165
+ declare const index$5_isNonEmptyString: typeof isNonEmptyString;
150
166
  declare const index$5_isNull: typeof isNull;
167
+ declare const index$5_isNullish: typeof isNullish;
151
168
  declare const index$5_isNumber: typeof isNumber;
152
169
  declare const index$5_isNumberOrUndefined: typeof isNumberOrUndefined;
153
170
  declare const index$5_isObjectOrUndefined: typeof isObjectOrUndefined;
171
+ declare const index$5_isPosInfinity: typeof isPosInfinity;
154
172
  declare const index$5_isString: typeof isString;
155
173
  declare const index$5_isStringOrUndefined: typeof isStringOrUndefined;
156
174
  declare const index$5_isUndefined: typeof isUndefined;
157
175
  declare namespace index$5 {
158
- export { index$5_isArray as isArray, index$5_isArrayOrUndefined as isArrayOrUndefined, index$5_isBoolean as isBoolean, index$5_isBooleanOrUndefined as isBooleanOrUndefined, index$5_isEnumValue as isEnumValue, index$5_isEnumValueOrUndefined as isEnumValueOrUndefined, index$5_isFunction as isFunction, index$5_isFunctionOrUndefined as isFunctionOrUndefined, isInteger$1 as isInteger, 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_isNull as isNull, index$5_isNumber as isNumber, index$5_isNumberOrUndefined as isNumberOrUndefined, isObject$1 as isObject, index$5_isObjectOrUndefined as isObjectOrUndefined, index$5_isString as isString, index$5_isStringOrUndefined as isStringOrUndefined, index$5_isUndefined as isUndefined };
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 };
159
177
  }
160
178
 
161
179
  declare function getMapKeys<K, V>(map: Map<K, V>): K[];
@@ -247,12 +265,20 @@ declare function insertAt(str: string, pos: number, insertStr: string): string;
247
265
  * @param removeCount
248
266
  */
249
267
  declare function removeAt(str: string, pos: number, removeCount: number): string;
268
+ /**
269
+ * Count number of char in string.
270
+ * @param str
271
+ * @param ch - must be single char.
272
+ * @returns number of chars in string.
273
+ */
274
+ declare function charCount(str: string, ch: string): number;
250
275
  /**
251
276
  * "UndeclaredVariable" => "Undeclared variable"
252
277
  * @param PascalString
253
278
  */
254
279
  declare function makeSentenceFromPascal(PascalString: string): string;
255
280
 
281
+ declare const index$1_charCount: typeof charCount;
256
282
  declare const index$1_chunkString: typeof chunkString;
257
283
  declare const index$1_insertAt: typeof insertAt;
258
284
  declare const index$1_makeSentenceFromPascal: typeof makeSentenceFromPascal;
@@ -261,7 +287,7 @@ declare const index$1_repeatString: typeof repeatString;
261
287
  declare const index$1_replaceAt: typeof replaceAt;
262
288
  declare const index$1_toCharArray: typeof toCharArray;
263
289
  declare namespace index$1 {
264
- export { index$1_chunkString as chunkString, index$1_insertAt as insertAt, index$1_makeSentenceFromPascal as makeSentenceFromPascal, index$1_removeAt as removeAt, index$1_repeatString as repeatString, index$1_replaceAt as replaceAt, index$1_toCharArray as toCharArray };
290
+ export { index$1_charCount as charCount, index$1_chunkString as chunkString, index$1_insertAt as insertAt, index$1_makeSentenceFromPascal as makeSentenceFromPascal, index$1_removeAt as removeAt, index$1_repeatString as repeatString, index$1_replaceAt as replaceAt, index$1_toCharArray as toCharArray };
265
291
  }
266
292
 
267
293
  declare namespace index {
package/dist/index.d.ts CHANGED
@@ -113,49 +113,67 @@ declare namespace index$6 {
113
113
 
114
114
  declare function isUndefined(value: unknown): value is undefined;
115
115
  declare function isNull(value: unknown): value is null;
116
+ declare function isNullish(value: unknown): value is null | undefined;
116
117
  declare function isObject$1(value: unknown): value is Record<string, unknown>;
117
118
  declare function isObjectOrUndefined(value: unknown): value is Record<string, unknown> | undefined;
118
119
  declare function isArray<T>(a: T[] | unknown): a is T[];
119
120
  declare function isArrayOrUndefined(value: unknown): value is unknown[] | undefined;
120
121
  declare function isString(value: unknown): value is string;
122
+ declare function isEmptyString(value: unknown): value is "";
123
+ declare function isNonEmptyString(value: unknown): value is string;
121
124
  declare function isStringOrUndefined(value: unknown): value is string | undefined;
122
125
  declare function isBoolean(value: unknown): value is boolean;
123
126
  declare function isBooleanOrUndefined(value: unknown): value is boolean | undefined;
124
127
  declare function isFunction(value: unknown): value is Function;
125
128
  declare function isFunctionOrUndefined(value: unknown): value is Function | undefined;
126
- declare function isNumber(value: unknown): value is number;
127
- declare function isNumberOrUndefined(value: unknown): value is number | undefined;
128
129
  declare function isEnumValue<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E];
129
130
  declare function isEnumValueOrUndefined<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E] | undefined;
131
+ declare function isNumber(value: unknown): value is number;
132
+ declare function isNumberOrUndefined(value: unknown): value is number | undefined;
130
133
  declare function isInteger$1(n: unknown): n is number;
134
+ declare function isIntegerOrUndefined(n: unknown): n is number | undefined;
131
135
  declare function isIntegerEq(value: unknown, compareTo: number): value is number;
132
136
  declare function isIntegerGt(value: unknown, compareTo: number): value is number;
133
137
  declare function isIntegerGte(value: unknown, compareTo: number): value is number;
134
138
  declare function isIntegerLt(value: unknown, compareTo: number): value is number;
135
139
  declare function isIntegerLte(value: unknown, compareTo: number): value is number;
140
+ declare function isIntegerBetween(value: unknown, min: number, max: number): value is number;
141
+ declare function isNaNValue(value: unknown): value is number;
142
+ declare function isInfinity(value: unknown): value is number;
143
+ declare function isPosInfinity(value: unknown): value is number;
144
+ declare function isNegInfinity(value: unknown): value is number;
136
145
 
137
146
  declare const index$5_isArray: typeof isArray;
138
147
  declare const index$5_isArrayOrUndefined: typeof isArrayOrUndefined;
139
148
  declare const index$5_isBoolean: typeof isBoolean;
140
149
  declare const index$5_isBooleanOrUndefined: typeof isBooleanOrUndefined;
150
+ declare const index$5_isEmptyString: typeof isEmptyString;
141
151
  declare const index$5_isEnumValue: typeof isEnumValue;
142
152
  declare const index$5_isEnumValueOrUndefined: typeof isEnumValueOrUndefined;
143
153
  declare const index$5_isFunction: typeof isFunction;
144
154
  declare const index$5_isFunctionOrUndefined: typeof isFunctionOrUndefined;
155
+ declare const index$5_isInfinity: typeof isInfinity;
156
+ declare const index$5_isIntegerBetween: typeof isIntegerBetween;
145
157
  declare const index$5_isIntegerEq: typeof isIntegerEq;
146
158
  declare const index$5_isIntegerGt: typeof isIntegerGt;
147
159
  declare const index$5_isIntegerGte: typeof isIntegerGte;
148
160
  declare const index$5_isIntegerLt: typeof isIntegerLt;
149
161
  declare const index$5_isIntegerLte: typeof isIntegerLte;
162
+ declare const index$5_isIntegerOrUndefined: typeof isIntegerOrUndefined;
163
+ declare const index$5_isNaNValue: typeof isNaNValue;
164
+ declare const index$5_isNegInfinity: typeof isNegInfinity;
165
+ declare const index$5_isNonEmptyString: typeof isNonEmptyString;
150
166
  declare const index$5_isNull: typeof isNull;
167
+ declare const index$5_isNullish: typeof isNullish;
151
168
  declare const index$5_isNumber: typeof isNumber;
152
169
  declare const index$5_isNumberOrUndefined: typeof isNumberOrUndefined;
153
170
  declare const index$5_isObjectOrUndefined: typeof isObjectOrUndefined;
171
+ declare const index$5_isPosInfinity: typeof isPosInfinity;
154
172
  declare const index$5_isString: typeof isString;
155
173
  declare const index$5_isStringOrUndefined: typeof isStringOrUndefined;
156
174
  declare const index$5_isUndefined: typeof isUndefined;
157
175
  declare namespace index$5 {
158
- export { index$5_isArray as isArray, index$5_isArrayOrUndefined as isArrayOrUndefined, index$5_isBoolean as isBoolean, index$5_isBooleanOrUndefined as isBooleanOrUndefined, index$5_isEnumValue as isEnumValue, index$5_isEnumValueOrUndefined as isEnumValueOrUndefined, index$5_isFunction as isFunction, index$5_isFunctionOrUndefined as isFunctionOrUndefined, isInteger$1 as isInteger, 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_isNull as isNull, index$5_isNumber as isNumber, index$5_isNumberOrUndefined as isNumberOrUndefined, isObject$1 as isObject, index$5_isObjectOrUndefined as isObjectOrUndefined, index$5_isString as isString, index$5_isStringOrUndefined as isStringOrUndefined, index$5_isUndefined as isUndefined };
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 };
159
177
  }
160
178
 
161
179
  declare function getMapKeys<K, V>(map: Map<K, V>): K[];
@@ -247,12 +265,20 @@ declare function insertAt(str: string, pos: number, insertStr: string): string;
247
265
  * @param removeCount
248
266
  */
249
267
  declare function removeAt(str: string, pos: number, removeCount: number): string;
268
+ /**
269
+ * Count number of char in string.
270
+ * @param str
271
+ * @param ch - must be single char.
272
+ * @returns number of chars in string.
273
+ */
274
+ declare function charCount(str: string, ch: string): number;
250
275
  /**
251
276
  * "UndeclaredVariable" => "Undeclared variable"
252
277
  * @param PascalString
253
278
  */
254
279
  declare function makeSentenceFromPascal(PascalString: string): string;
255
280
 
281
+ declare const index$1_charCount: typeof charCount;
256
282
  declare const index$1_chunkString: typeof chunkString;
257
283
  declare const index$1_insertAt: typeof insertAt;
258
284
  declare const index$1_makeSentenceFromPascal: typeof makeSentenceFromPascal;
@@ -261,7 +287,7 @@ declare const index$1_repeatString: typeof repeatString;
261
287
  declare const index$1_replaceAt: typeof replaceAt;
262
288
  declare const index$1_toCharArray: typeof toCharArray;
263
289
  declare namespace index$1 {
264
- export { index$1_chunkString as chunkString, index$1_insertAt as insertAt, index$1_makeSentenceFromPascal as makeSentenceFromPascal, index$1_removeAt as removeAt, index$1_repeatString as repeatString, index$1_replaceAt as replaceAt, index$1_toCharArray as toCharArray };
290
+ export { index$1_charCount as charCount, index$1_chunkString as chunkString, index$1_insertAt as insertAt, index$1_makeSentenceFromPascal as makeSentenceFromPascal, index$1_removeAt as removeAt, index$1_repeatString as repeatString, index$1_replaceAt as replaceAt, index$1_toCharArray as toCharArray };
265
291
  }
266
292
 
267
293
  declare namespace index {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* TsUtilsLib v1.3.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
1
+ /* TsUtilsLib v1.5.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,21 +707,30 @@ __export(is_exports, {
707
707
  isArrayOrUndefined: () => isArrayOrUndefined,
708
708
  isBoolean: () => isBoolean,
709
709
  isBooleanOrUndefined: () => isBooleanOrUndefined,
710
+ isEmptyString: () => isEmptyString,
710
711
  isEnumValue: () => isEnumValue,
711
712
  isEnumValueOrUndefined: () => isEnumValueOrUndefined,
712
713
  isFunction: () => isFunction,
713
714
  isFunctionOrUndefined: () => isFunctionOrUndefined,
715
+ isInfinity: () => isInfinity,
714
716
  isInteger: () => isInteger2,
717
+ isIntegerBetween: () => isIntegerBetween,
715
718
  isIntegerEq: () => isIntegerEq,
716
719
  isIntegerGt: () => isIntegerGt,
717
720
  isIntegerGte: () => isIntegerGte,
718
721
  isIntegerLt: () => isIntegerLt,
719
722
  isIntegerLte: () => isIntegerLte,
723
+ isIntegerOrUndefined: () => isIntegerOrUndefined,
724
+ isNaNValue: () => isNaNValue,
725
+ isNegInfinity: () => isNegInfinity,
726
+ isNonEmptyString: () => isNonEmptyString,
720
727
  isNull: () => isNull,
728
+ isNullish: () => isNullish,
721
729
  isNumber: () => isNumber,
722
730
  isNumberOrUndefined: () => isNumberOrUndefined,
723
731
  isObject: () => isObject,
724
732
  isObjectOrUndefined: () => isObjectOrUndefined,
733
+ isPosInfinity: () => isPosInfinity,
725
734
  isString: () => isString,
726
735
  isStringOrUndefined: () => isStringOrUndefined,
727
736
  isUndefined: () => isUndefined
@@ -732,6 +741,9 @@ function isUndefined(value) {
732
741
  function isNull(value) {
733
742
  return value === null;
734
743
  }
744
+ function isNullish(value) {
745
+ return value === void 0 || value === null;
746
+ }
735
747
  function isObject(value) {
736
748
  return typeof value === "object" && value !== null && !isArray2(value);
737
749
  }
@@ -747,6 +759,12 @@ function isArrayOrUndefined(value) {
747
759
  function isString(value) {
748
760
  return typeof value === "string";
749
761
  }
762
+ function isEmptyString(value) {
763
+ return typeof value === "string" && value.length === 0;
764
+ }
765
+ function isNonEmptyString(value) {
766
+ return typeof value === "string" && value.length > 0;
767
+ }
750
768
  function isStringOrUndefined(value) {
751
769
  return value === void 0 || typeof value === "string";
752
770
  }
@@ -762,21 +780,24 @@ function isFunction(value) {
762
780
  function isFunctionOrUndefined(value) {
763
781
  return value === void 0 || typeof value === "function";
764
782
  }
765
- function isNumber(value) {
766
- return typeof value === "number";
767
- }
768
- function isNumberOrUndefined(value) {
769
- return value === void 0 || typeof value === "number";
770
- }
771
783
  function isEnumValue(value, enumObj, name = "value") {
772
784
  return getEnumValues(enumObj).some((v) => v === value);
773
785
  }
774
786
  function isEnumValueOrUndefined(value, enumObj, name = "value") {
775
787
  return value === void 0 || getEnumValues(enumObj).some((v) => v === value);
776
788
  }
789
+ function isNumber(value) {
790
+ return typeof value === "number";
791
+ }
792
+ function isNumberOrUndefined(value) {
793
+ return typeof value === "number" || value === void 0;
794
+ }
777
795
  function isInteger2(n) {
778
796
  return typeof n === "number" && isFinite(n) && n === Math.trunc(n);
779
797
  }
798
+ function isIntegerOrUndefined(n) {
799
+ return typeof n === "number" && isFinite(n) && n === Math.trunc(n) || n === void 0;
800
+ }
780
801
  function isIntegerEq(value, compareTo) {
781
802
  return isInteger2(value) && value === compareTo;
782
803
  }
@@ -792,6 +813,21 @@ function isIntegerLt(value, compareTo) {
792
813
  function isIntegerLte(value, compareTo) {
793
814
  return isInteger2(value) && value <= compareTo;
794
815
  }
816
+ function isIntegerBetween(value, min, max) {
817
+ return isInteger2(value) && value >= min && value <= max;
818
+ }
819
+ function isNaNValue(value) {
820
+ return typeof value === "number" && Number.isNaN(value);
821
+ }
822
+ function isInfinity(value) {
823
+ return typeof value === "number" && Math.abs(value) === Infinity;
824
+ }
825
+ function isPosInfinity(value) {
826
+ return typeof value === "number" && value === Infinity;
827
+ }
828
+ function isNegInfinity(value) {
829
+ return typeof value === "number" && value === -Infinity;
830
+ }
795
831
 
796
832
  // src/utils/map/index.ts
797
833
  var map_exports = {};
@@ -816,6 +852,7 @@ function isObject2(value) {
816
852
  // src/utils/str/index.ts
817
853
  var str_exports = {};
818
854
  __export(str_exports, {
855
+ charCount: () => charCount,
819
856
  chunkString: () => chunkString,
820
857
  insertAt: () => insertAt,
821
858
  makeSentenceFromPascal: () => makeSentenceFromPascal,
@@ -858,6 +895,14 @@ function insertAt(str, pos, insertStr) {
858
895
  function removeAt(str, pos, removeCount) {
859
896
  return replaceAt(str, pos, removeCount, "");
860
897
  }
898
+ function charCount(str, ch) {
899
+ if (ch.length !== 1 || str.length === 0) return 0;
900
+ let count = 0;
901
+ for (let i = 0; i < str.length; i++) {
902
+ if (str[i] === ch) count++;
903
+ }
904
+ return count;
905
+ }
861
906
  function makeSentenceFromPascal(PascalString) {
862
907
  if (PascalString === "") {
863
908
  return "";
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /* TsUtilsLib v1.3.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
1
+ /* TsUtilsLib v1.5.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,21 +680,30 @@ __export(is_exports, {
680
680
  isArrayOrUndefined: () => isArrayOrUndefined,
681
681
  isBoolean: () => isBoolean,
682
682
  isBooleanOrUndefined: () => isBooleanOrUndefined,
683
+ isEmptyString: () => isEmptyString,
683
684
  isEnumValue: () => isEnumValue,
684
685
  isEnumValueOrUndefined: () => isEnumValueOrUndefined,
685
686
  isFunction: () => isFunction,
686
687
  isFunctionOrUndefined: () => isFunctionOrUndefined,
688
+ isInfinity: () => isInfinity,
687
689
  isInteger: () => isInteger2,
690
+ isIntegerBetween: () => isIntegerBetween,
688
691
  isIntegerEq: () => isIntegerEq,
689
692
  isIntegerGt: () => isIntegerGt,
690
693
  isIntegerGte: () => isIntegerGte,
691
694
  isIntegerLt: () => isIntegerLt,
692
695
  isIntegerLte: () => isIntegerLte,
696
+ isIntegerOrUndefined: () => isIntegerOrUndefined,
697
+ isNaNValue: () => isNaNValue,
698
+ isNegInfinity: () => isNegInfinity,
699
+ isNonEmptyString: () => isNonEmptyString,
693
700
  isNull: () => isNull,
701
+ isNullish: () => isNullish,
694
702
  isNumber: () => isNumber,
695
703
  isNumberOrUndefined: () => isNumberOrUndefined,
696
704
  isObject: () => isObject,
697
705
  isObjectOrUndefined: () => isObjectOrUndefined,
706
+ isPosInfinity: () => isPosInfinity,
698
707
  isString: () => isString,
699
708
  isStringOrUndefined: () => isStringOrUndefined,
700
709
  isUndefined: () => isUndefined
@@ -705,6 +714,9 @@ function isUndefined(value) {
705
714
  function isNull(value) {
706
715
  return value === null;
707
716
  }
717
+ function isNullish(value) {
718
+ return value === void 0 || value === null;
719
+ }
708
720
  function isObject(value) {
709
721
  return typeof value === "object" && value !== null && !isArray2(value);
710
722
  }
@@ -720,6 +732,12 @@ function isArrayOrUndefined(value) {
720
732
  function isString(value) {
721
733
  return typeof value === "string";
722
734
  }
735
+ function isEmptyString(value) {
736
+ return typeof value === "string" && value.length === 0;
737
+ }
738
+ function isNonEmptyString(value) {
739
+ return typeof value === "string" && value.length > 0;
740
+ }
723
741
  function isStringOrUndefined(value) {
724
742
  return value === void 0 || typeof value === "string";
725
743
  }
@@ -735,21 +753,24 @@ function isFunction(value) {
735
753
  function isFunctionOrUndefined(value) {
736
754
  return value === void 0 || typeof value === "function";
737
755
  }
738
- function isNumber(value) {
739
- return typeof value === "number";
740
- }
741
- function isNumberOrUndefined(value) {
742
- return value === void 0 || typeof value === "number";
743
- }
744
756
  function isEnumValue(value, enumObj, name = "value") {
745
757
  return getEnumValues(enumObj).some((v) => v === value);
746
758
  }
747
759
  function isEnumValueOrUndefined(value, enumObj, name = "value") {
748
760
  return value === void 0 || getEnumValues(enumObj).some((v) => v === value);
749
761
  }
762
+ function isNumber(value) {
763
+ return typeof value === "number";
764
+ }
765
+ function isNumberOrUndefined(value) {
766
+ return typeof value === "number" || value === void 0;
767
+ }
750
768
  function isInteger2(n) {
751
769
  return typeof n === "number" && isFinite(n) && n === Math.trunc(n);
752
770
  }
771
+ function isIntegerOrUndefined(n) {
772
+ return typeof n === "number" && isFinite(n) && n === Math.trunc(n) || n === void 0;
773
+ }
753
774
  function isIntegerEq(value, compareTo) {
754
775
  return isInteger2(value) && value === compareTo;
755
776
  }
@@ -765,6 +786,21 @@ function isIntegerLt(value, compareTo) {
765
786
  function isIntegerLte(value, compareTo) {
766
787
  return isInteger2(value) && value <= compareTo;
767
788
  }
789
+ function isIntegerBetween(value, min, max) {
790
+ return isInteger2(value) && value >= min && value <= max;
791
+ }
792
+ function isNaNValue(value) {
793
+ return typeof value === "number" && Number.isNaN(value);
794
+ }
795
+ function isInfinity(value) {
796
+ return typeof value === "number" && Math.abs(value) === Infinity;
797
+ }
798
+ function isPosInfinity(value) {
799
+ return typeof value === "number" && value === Infinity;
800
+ }
801
+ function isNegInfinity(value) {
802
+ return typeof value === "number" && value === -Infinity;
803
+ }
768
804
 
769
805
  // src/utils/map/index.ts
770
806
  var map_exports = {};
@@ -789,6 +825,7 @@ function isObject2(value) {
789
825
  // src/utils/str/index.ts
790
826
  var str_exports = {};
791
827
  __export(str_exports, {
828
+ charCount: () => charCount,
792
829
  chunkString: () => chunkString,
793
830
  insertAt: () => insertAt,
794
831
  makeSentenceFromPascal: () => makeSentenceFromPascal,
@@ -831,6 +868,14 @@ function insertAt(str, pos, insertStr) {
831
868
  function removeAt(str, pos, removeCount) {
832
869
  return replaceAt(str, pos, removeCount, "");
833
870
  }
871
+ function charCount(str, ch) {
872
+ if (ch.length !== 1 || str.length === 0) return 0;
873
+ let count = 0;
874
+ for (let i = 0; i < str.length; i++) {
875
+ if (str[i] === ch) count++;
876
+ }
877
+ return count;
878
+ }
834
879
  function makeSentenceFromPascal(PascalString) {
835
880
  if (PascalString === "") {
836
881
  return "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tspro/ts-utils-lib",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "author": "PahkaSoft",
5
5
  "license": "MIT",
6
6
  "private": false,