@rightcapital/assert 3.0.0 → 3.0.1-renovate-auto-merge-dev-dependencies-updates.2387.1.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/index.js +7 -7
- package/lib/index.js.map +1 -1
- package/package.json +10 -10
package/lib/index.js
CHANGED
|
@@ -19,7 +19,13 @@
|
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.
|
|
22
|
+
exports.AssertionError = void 0;
|
|
23
|
+
exports.assert = assert;
|
|
24
|
+
exports.assertNonNullable = assertNonNullable;
|
|
25
|
+
exports.ensure = ensure;
|
|
26
|
+
exports.ensureNonNullable = ensureNonNullable;
|
|
27
|
+
exports.assertUnreachable = assertUnreachable;
|
|
28
|
+
exports.assertExhaustive = assertExhaustive;
|
|
23
29
|
/**
|
|
24
30
|
* Error thrown when an assertion fails.
|
|
25
31
|
*/
|
|
@@ -58,7 +64,6 @@ function assert(value, message) {
|
|
|
58
64
|
throwError('assert', value, message);
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
|
-
exports.assert = assert;
|
|
62
67
|
/**
|
|
63
68
|
* Asserts that a value is not `null` or `undefined`, providing TypeScript type narrowing to `NonNullable<T>`.
|
|
64
69
|
* Ensures subsequent code can safely access the value.
|
|
@@ -81,7 +86,6 @@ function assertNonNullable(value, message) {
|
|
|
81
86
|
throwError('assertNonNullable', value, message);
|
|
82
87
|
}
|
|
83
88
|
}
|
|
84
|
-
exports.assertNonNullable = assertNonNullable;
|
|
85
89
|
/**
|
|
86
90
|
* Similar to `assert`, but returns the value. Ensures a value matches a type predicate and returns it with narrowed type.
|
|
87
91
|
*
|
|
@@ -111,7 +115,6 @@ function ensure(value, predicate, message) {
|
|
|
111
115
|
assert(predicate(value), message);
|
|
112
116
|
return value;
|
|
113
117
|
}
|
|
114
|
-
exports.ensure = ensure;
|
|
115
118
|
/**
|
|
116
119
|
* Similar to `assertNonNullable`, but returns the value. Ensures a value is not null/undefined and returns it.
|
|
117
120
|
*
|
|
@@ -138,7 +141,6 @@ function ensureNonNullable(value, message) {
|
|
|
138
141
|
}
|
|
139
142
|
return value;
|
|
140
143
|
}
|
|
141
|
-
exports.ensureNonNullable = ensureNonNullable;
|
|
142
144
|
/**
|
|
143
145
|
* Marks code branches that should theoretically never be reached.
|
|
144
146
|
* Used for defensive programming to prevent unexpected code execution when data or logic doesn't match expectations.
|
|
@@ -164,7 +166,6 @@ exports.ensureNonNullable = ensureNonNullable;
|
|
|
164
166
|
function assertUnreachable(message) {
|
|
165
167
|
throwError('assertUnreachable', null, message);
|
|
166
168
|
}
|
|
167
|
-
exports.assertUnreachable = assertUnreachable;
|
|
168
169
|
/**
|
|
169
170
|
* Used for exhaustiveness checking of union types. Ensures switch or if-else statements cover all possible types.
|
|
170
171
|
* Leverages TypeScript's `never` type to catch missing branches at compile time.
|
|
@@ -201,5 +202,4 @@ exports.assertUnreachable = assertUnreachable;
|
|
|
201
202
|
function assertExhaustive(value, message) {
|
|
202
203
|
throwError('assertExhaustive', value, message);
|
|
203
204
|
}
|
|
204
|
-
exports.assertExhaustive = assertExhaustive;
|
|
205
205
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAqCH,wBAIC;AAmBD,8CAOC;AA2BD,wBAOC;AAsBD,8CAQC;AAwBD,8CAEC;AAmCD,4CAEC;AAhMD;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK;IAAzC;;QAC2B,SAAI,GAAG,gBAAgB,CAAC;IACnD,CAAC;CAAA;AAF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AAC;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAgB,gBAAgB,CAAC,KAAY,EAAE,OAAgB;IAC7D,UAAU,CAAC,kBAAkB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rightcapital/assert",
|
|
3
|
-
"version": "3.0.0",
|
|
3
|
+
"version": "3.0.1-renovate-auto-merge-dev-dependencies-updates.2387.1.0",
|
|
4
4
|
"description": "Type-safe assertion utilities for defensive programming.",
|
|
5
|
-
"author": "RightCapital Ecosystem team <npm-publisher@rightcapital.com>",
|
|
6
5
|
"keywords": [
|
|
7
6
|
"assertion",
|
|
8
7
|
"type-safe",
|
|
@@ -12,15 +11,16 @@
|
|
|
12
11
|
"tanstack-intent",
|
|
13
12
|
"utilities"
|
|
14
13
|
],
|
|
15
|
-
"sideEffects": false,
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"main": "lib/index.js",
|
|
18
|
-
"typings": "lib/index.d.ts",
|
|
19
14
|
"repository": {
|
|
20
15
|
"type": "git",
|
|
21
16
|
"url": "git+https://github.com/RightCapitalHQ/frontend-libraries.git",
|
|
22
17
|
"directory": "packages/assert"
|
|
23
18
|
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "RightCapital Ecosystem team <npm-publisher@rightcapital.com>",
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"main": "lib/index.js",
|
|
23
|
+
"typings": "lib/index.d.ts",
|
|
24
24
|
"directories": {
|
|
25
25
|
"lib": "lib"
|
|
26
26
|
},
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"skills",
|
|
30
30
|
"src"
|
|
31
31
|
],
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"typedoc": "0.28.20",
|
|
34
|
+
"typedoc-plugin-markdown": "4.12.0"
|
|
35
|
+
},
|
|
32
36
|
"publishConfig": {
|
|
33
37
|
"registry": "https://registry.npmjs.org"
|
|
34
38
|
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"typedoc": "0.25.7",
|
|
37
|
-
"typedoc-plugin-markdown": "3.17.1"
|
|
38
|
-
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"docs": "pnpm exec typedoc --plugin typedoc-plugin-markdown --out docs src/index.ts"
|
|
41
41
|
}
|