@tspro/ts-utils-lib 1.7.0 → 1.8.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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.8.0] - 2025-10-07
4
+ ### Added
5
+ - Utils.Math.cmp()
6
+
3
7
  ## [1.7.0] - 2025-10-03
4
8
  ### Added
5
9
  - Utils.Obj.hasProperties()
package/dist/index.d.mts CHANGED
@@ -217,9 +217,11 @@ declare function calcNormal(x1: number, y1: number, x2: number, y2: number): {
217
217
  ny: number;
218
218
  };
219
219
  declare function sum(arr: number[]): number;
220
+ declare function cmp(a: number, b: number): -1 | 0 | 1;
220
221
 
221
222
  declare const index$3_calcNormal: typeof calcNormal;
222
223
  declare const index$3_clamp: typeof clamp;
224
+ declare const index$3_cmp: typeof cmp;
223
225
  declare const index$3_interpolateCoord: typeof interpolateCoord;
224
226
  declare const index$3_interpolateY: typeof interpolateY;
225
227
  declare const index$3_isInteger: typeof isInteger;
@@ -229,7 +231,7 @@ declare const index$3_romanize: typeof romanize;
229
231
  declare const index$3_sum: typeof sum;
230
232
  declare const index$3_toOrdinalNumber: typeof toOrdinalNumber;
231
233
  declare namespace index$3 {
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 };
234
+ export { index$3_calcNormal as calcNormal, index$3_clamp as clamp, index$3_cmp as cmp, 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 };
233
235
  }
234
236
 
235
237
  declare function isObject(obj: unknown): obj is Record<string, unknown>;
package/dist/index.d.ts CHANGED
@@ -217,9 +217,11 @@ declare function calcNormal(x1: number, y1: number, x2: number, y2: number): {
217
217
  ny: number;
218
218
  };
219
219
  declare function sum(arr: number[]): number;
220
+ declare function cmp(a: number, b: number): -1 | 0 | 1;
220
221
 
221
222
  declare const index$3_calcNormal: typeof calcNormal;
222
223
  declare const index$3_clamp: typeof clamp;
224
+ declare const index$3_cmp: typeof cmp;
223
225
  declare const index$3_interpolateCoord: typeof interpolateCoord;
224
226
  declare const index$3_interpolateY: typeof interpolateY;
225
227
  declare const index$3_isInteger: typeof isInteger;
@@ -229,7 +231,7 @@ declare const index$3_romanize: typeof romanize;
229
231
  declare const index$3_sum: typeof sum;
230
232
  declare const index$3_toOrdinalNumber: typeof toOrdinalNumber;
231
233
  declare namespace index$3 {
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 };
234
+ export { index$3_calcNormal as calcNormal, index$3_clamp as clamp, index$3_cmp as cmp, 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 };
233
235
  }
234
236
 
235
237
  declare function isObject(obj: unknown): obj is Record<string, unknown>;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* TsUtilsLib v1.7.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
1
+ /* TsUtilsLib v1.8.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;
@@ -69,6 +69,7 @@ var math_exports = {};
69
69
  __export(math_exports, {
70
70
  calcNormal: () => calcNormal,
71
71
  clamp: () => clamp,
72
+ cmp: () => cmp,
72
73
  interpolateCoord: () => interpolateCoord,
73
74
  interpolateY: () => interpolateY,
74
75
  isInteger: () => isInteger,
@@ -181,6 +182,9 @@ function calcNormal(x1, y1, x2, y2) {
181
182
  function sum(arr) {
182
183
  return arr.reduce((prev, cur) => cur + prev, 0);
183
184
  }
185
+ function cmp(a, b) {
186
+ return a < b ? -1 : a > b ? 1 : 0;
187
+ }
184
188
 
185
189
  // src/utils/arr/index.ts
186
190
  function isArray(a) {
@@ -195,8 +199,8 @@ function duplicate(a) {
195
199
  function removeDuplicates(a) {
196
200
  return a.filter((item, pos, arr) => arr.indexOf(item) === pos);
197
201
  }
198
- function removeDuplicatesCmp(arr, cmp) {
199
- return arr.filter((t1, index, self) => index === self.findIndex((t2) => cmp(t1, t2)));
202
+ function removeDuplicatesCmp(arr, cmp2) {
203
+ return arr.filter((t1, index, self) => index === self.findIndex((t2) => cmp2(t1, t2)));
200
204
  }
201
205
  function fillArray(fillValue, fillCount) {
202
206
  if (!isInteger(fillCount) || fillCount < 0) {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /* TsUtilsLib v1.7.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
1
+ /* TsUtilsLib v1.8.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) => {
@@ -42,6 +42,7 @@ var math_exports = {};
42
42
  __export(math_exports, {
43
43
  calcNormal: () => calcNormal,
44
44
  clamp: () => clamp,
45
+ cmp: () => cmp,
45
46
  interpolateCoord: () => interpolateCoord,
46
47
  interpolateY: () => interpolateY,
47
48
  isInteger: () => isInteger,
@@ -154,6 +155,9 @@ function calcNormal(x1, y1, x2, y2) {
154
155
  function sum(arr) {
155
156
  return arr.reduce((prev, cur) => cur + prev, 0);
156
157
  }
158
+ function cmp(a, b) {
159
+ return a < b ? -1 : a > b ? 1 : 0;
160
+ }
157
161
 
158
162
  // src/utils/arr/index.ts
159
163
  function isArray(a) {
@@ -168,8 +172,8 @@ function duplicate(a) {
168
172
  function removeDuplicates(a) {
169
173
  return a.filter((item, pos, arr) => arr.indexOf(item) === pos);
170
174
  }
171
- function removeDuplicatesCmp(arr, cmp) {
172
- return arr.filter((t1, index, self) => index === self.findIndex((t2) => cmp(t1, t2)));
175
+ function removeDuplicatesCmp(arr, cmp2) {
176
+ return arr.filter((t1, index, self) => index === self.findIndex((t2) => cmp2(t1, t2)));
173
177
  }
174
178
  function fillArray(fillValue, fillCount) {
175
179
  if (!isInteger(fillCount) || fillCount < 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tspro/ts-utils-lib",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "author": "PahkaSoft",
5
5
  "license": "MIT",
6
6
  "private": false,