@infra-blocks/types 0.11.0-alpha.1 → 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.
- package/lib/cjs/guard.d.ts +1 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/predicates.d.ts +11 -0
- package/lib/cjs/predicates.js +18 -0
- package/lib/cjs/predicates.js.map +1 -0
- package/lib/esm/guard.d.ts +1 -1
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/predicates.d.ts +11 -0
- package/lib/esm/predicates.js +14 -0
- package/lib/esm/predicates.js.map +1 -0
- package/package.json +1 -1
package/lib/cjs/guard.d.ts
CHANGED
|
@@ -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
|
*
|
package/lib/cjs/index.d.ts
CHANGED
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
|
*
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,6CAA2B;AAC3B,8CAA4B;
|
|
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"}
|
package/lib/esm/guard.d.ts
CHANGED
|
@@ -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
|
*
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -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;
|
|
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"}
|