@tspro/ts-utils-lib 1.6.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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.0] - 2025-10-03
4
+ ### Added
5
+ - Utils.Obj.hasProperties()
6
+
3
7
  ## [1.6.0] - 2025-09-16
4
8
  ### Added
5
9
  - Utils.Is.isEmptyArray()
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # Ts Utils Lib
2
+
3
+ NPM Package: [@tspro/ts-utils-lib](https://www.npmjs.com/package/@tspro/ts-utils-lib)
4
+
5
+ This typescript library contains some useful classes, modules and
6
+ functions shared across multiple projects.
package/dist/index.d.mts CHANGED
@@ -232,11 +232,20 @@ declare namespace index$3 {
232
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 };
233
233
  }
234
234
 
235
- declare function isObject(value: unknown): value is Record<string, unknown>;
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>;
236
244
 
245
+ declare const index$2_hasProperties: typeof hasProperties;
237
246
  declare const index$2_isObject: typeof isObject;
238
247
  declare namespace index$2 {
239
- export { index$2_isObject as isObject };
248
+ export { index$2_hasProperties as hasProperties, index$2_isObject as isObject };
240
249
  }
241
250
 
242
251
  /**
package/dist/index.d.ts CHANGED
@@ -232,11 +232,20 @@ declare namespace index$3 {
232
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 };
233
233
  }
234
234
 
235
- declare function isObject(value: unknown): value is Record<string, unknown>;
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>;
236
244
 
245
+ declare const index$2_hasProperties: typeof hasProperties;
237
246
  declare const index$2_isObject: typeof isObject;
238
247
  declare namespace index$2 {
239
- export { index$2_isObject as isObject };
248
+ export { index$2_hasProperties as hasProperties, index$2_isObject as isObject };
240
249
  }
241
250
 
242
251
  /**
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /* TsUtilsLib v1.6.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
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;
@@ -871,10 +871,14 @@ function getMapKeys(map) {
871
871
  // src/utils/obj/index.ts
872
872
  var obj_exports = {};
873
873
  __export(obj_exports, {
874
+ hasProperties: () => hasProperties,
874
875
  isObject: () => isObject2
875
876
  });
876
- function isObject2(value) {
877
- return typeof value === "object" && value !== null && !isArray(value);
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);
878
882
  }
879
883
 
880
884
  // src/utils/str/index.ts
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /* TsUtilsLib v1.6.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
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) => {
@@ -844,10 +844,14 @@ function getMapKeys(map) {
844
844
  // src/utils/obj/index.ts
845
845
  var obj_exports = {};
846
846
  __export(obj_exports, {
847
+ hasProperties: () => hasProperties,
847
848
  isObject: () => isObject2
848
849
  });
849
- function isObject2(value) {
850
- return typeof value === "object" && value !== null && !isArray(value);
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);
851
855
  }
852
856
 
853
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.6.0",
3
+ "version": "1.7.0",
4
4
  "author": "PahkaSoft",
5
5
  "license": "MIT",
6
6
  "private": false,
7
- "description": "",
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",