@infra-blocks/types 0.11.0 → 0.12.0-alpha.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.
@@ -70,7 +70,7 @@ export declare function isNull(value: unknown): value is null;
70
70
  *
71
71
  * @see https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards
72
72
  */
73
- export declare function isObject(value: unknown): value is object;
73
+ export declare function isObject(value: unknown): value is object | null;
74
74
  /**
75
75
  * A type guard to assess that a value is an object and not null.
76
76
  *
@@ -1,6 +1,7 @@
1
1
  export * from "./func.js";
2
2
  export * from "./guard.js";
3
3
  export * from "./events.js";
4
+ export * from "./predicates.js";
4
5
  /**
5
6
  * Convenience type to represent environment variables.
6
7
  */
package/lib/cjs/index.js CHANGED
@@ -18,6 +18,7 @@ exports.unreachable = void 0;
18
18
  __exportStar(require("./func.js"), exports);
19
19
  __exportStar(require("./guard.js"), exports);
20
20
  __exportStar(require("./events.js"), exports);
21
+ __exportStar(require("./predicates.js"), exports);
21
22
  /**
22
23
  * A function for forcing exhaustiveness in switch statements or if-else chains.
23
24
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;AAsD5B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC;AACf,CAAC;AAFD,kCAEC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;AAC5B,kDAAgC;AAsDhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC;AACf,CAAC;AAFD,kCAEC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A type predicate to determine if a value is a plain object.
3
+ *
4
+ * A plain object is created either with the object literal syntax or with the Object constructor.
5
+ * Any other type of object will not satisfy this predicate.
6
+ *
7
+ * @param value - The value to test.
8
+ *
9
+ * @returns Whether or not the value is a plain object.
10
+ */
11
+ export declare function isPlainObject(value: unknown): boolean;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPlainObject = void 0;
4
+ /**
5
+ * A type predicate to determine if a value is a plain object.
6
+ *
7
+ * A plain object is created either with the object literal syntax or with the Object constructor.
8
+ * Any other type of object will not satisfy this predicate.
9
+ *
10
+ * @param value - The value to test.
11
+ *
12
+ * @returns Whether or not the value is a plain object.
13
+ */
14
+ function isPlainObject(value) {
15
+ return (typeof value === "object" && value !== null && value.constructor === Object);
16
+ }
17
+ exports.isPlainObject = isPlainObject;
18
+ //# sourceMappingURL=predicates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicates.js","sourceRoot":"","sources":["../../src/predicates.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,SAAgB,aAAa,CAAC,KAAc;IAC1C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,WAAW,KAAK,MAAM,CAC5E,CAAC;AACJ,CAAC;AAJD,sCAIC"}
@@ -70,7 +70,7 @@ export declare function isNull(value: unknown): value is null;
70
70
  *
71
71
  * @see https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards
72
72
  */
73
- export declare function isObject(value: unknown): value is object;
73
+ export declare function isObject(value: unknown): value is object | null;
74
74
  /**
75
75
  * A type guard to assess that a value is an object and not null.
76
76
  *
@@ -1,6 +1,7 @@
1
1
  export * from "./func.js";
2
2
  export * from "./guard.js";
3
3
  export * from "./events.js";
4
+ export * from "./predicates.js";
4
5
  /**
5
6
  * Convenience type to represent environment variables.
6
7
  */
package/lib/esm/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./func.js";
2
2
  export * from "./guard.js";
3
3
  export * from "./events.js";
4
+ export * from "./predicates.js";
4
5
  /**
5
6
  * A function for forcing exhaustiveness in switch statements or if-else chains.
6
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAsD5B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAsDhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * A type predicate to determine if a value is a plain object.
3
+ *
4
+ * A plain object is created either with the object literal syntax or with the Object constructor.
5
+ * Any other type of object will not satisfy this predicate.
6
+ *
7
+ * @param value - The value to test.
8
+ *
9
+ * @returns Whether or not the value is a plain object.
10
+ */
11
+ export declare function isPlainObject(value: unknown): boolean;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A type predicate to determine if a value is a plain object.
3
+ *
4
+ * A plain object is created either with the object literal syntax or with the Object constructor.
5
+ * Any other type of object will not satisfy this predicate.
6
+ *
7
+ * @param value - The value to test.
8
+ *
9
+ * @returns Whether or not the value is a plain object.
10
+ */
11
+ export function isPlainObject(value) {
12
+ return (typeof value === "object" && value !== null && value.constructor === Object);
13
+ }
14
+ //# sourceMappingURL=predicates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"predicates.js","sourceRoot":"","sources":["../../src/predicates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,WAAW,KAAK,MAAM,CAC5E,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infra-blocks/types",
3
- "version": "0.11.0",
3
+ "version": "0.12.0-alpha.0",
4
4
  "description": "Typescript types utility package.",
5
5
  "keywords": [
6
6
  "type",