@augment-vir/assert 30.0.0 → 30.0.2
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/README.md +11 -0
- package/dist/assertions/boolean.d.ts +443 -17
- package/dist/assertions/boolean.js +365 -8
- package/dist/assertions/boundary.d.ts +657 -13
- package/dist/assertions/boundary.js +537 -5
- package/dist/assertions/enum.d.ts +236 -8
- package/dist/assertions/enum.js +197 -5
- package/dist/assertions/equality/entry-equality.d.ts +287 -11
- package/dist/assertions/equality/entry-equality.js +243 -6
- package/dist/assertions/equality/json-equality.d.ts +244 -15
- package/dist/assertions/equality/json-equality.js +207 -11
- package/dist/assertions/equality/simple-equality.d.ts +849 -28
- package/dist/assertions/equality/simple-equality.js +712 -6
- package/dist/assertions/equality/ts-type-equality.d.ts +37 -1
- package/dist/assertions/equality/ts-type-equality.js +13 -1
- package/dist/assertions/extendable-assertions.d.ts +288 -120
- package/dist/assertions/extendable-assertions.js +32 -60
- package/dist/assertions/http.d.ts +217 -10
- package/dist/assertions/http.js +182 -6
- package/dist/assertions/instance.d.ts +189 -8
- package/dist/assertions/instance.js +159 -5
- package/dist/assertions/keys.d.ts +658 -13
- package/dist/assertions/keys.js +556 -5
- package/dist/assertions/length.d.ts +381 -9
- package/dist/assertions/length.js +309 -5
- package/dist/assertions/nullish.d.ts +169 -7
- package/dist/assertions/nullish.js +137 -6
- package/dist/assertions/numeric.d.ts +965 -11
- package/dist/assertions/numeric.js +819 -1
- package/dist/assertions/output.d.ts +107 -7
- package/dist/assertions/output.js +92 -5
- package/dist/assertions/primitive.d.ts +416 -13
- package/dist/assertions/primitive.js +352 -6
- package/dist/assertions/promise.d.ts +640 -21
- package/dist/assertions/promise.js +536 -15
- package/dist/assertions/regexp.d.ts +202 -3
- package/dist/assertions/regexp.js +173 -1
- package/dist/assertions/runtime-type.d.ts +1822 -41
- package/dist/assertions/runtime-type.js +1558 -35
- package/dist/assertions/throws.d.ts +265 -17
- package/dist/assertions/throws.js +229 -17
- package/dist/assertions/uuid.d.ts +233 -10
- package/dist/assertions/uuid.js +195 -6
- package/dist/assertions/values.d.ts +1086 -15
- package/dist/assertions/values.js +907 -6
- package/dist/augments/assertion.error.d.ts +2 -1
- package/dist/augments/assertion.error.js +2 -1
- package/dist/augments/guards/assert-wrap.d.ts +82 -37
- package/dist/augments/guards/assert-wrap.js +13 -2
- package/dist/augments/guards/assert.d.ts +30 -14
- package/dist/augments/guards/assert.js +21 -4
- package/dist/augments/guards/check-wrap.d.ts +94 -51
- package/dist/augments/guards/check-wrap.js +11 -3
- package/dist/augments/guards/check.d.ts +87 -37
- package/dist/augments/guards/check.js +9 -2
- package/dist/augments/guards/wait-until.d.ts +110 -103
- package/dist/augments/guards/wait-until.js +18 -3
- package/dist/augments/if-equals.d.ts +4 -2
- package/dist/guard-types/assert-wrap-function.d.ts +5 -2
- package/dist/guard-types/check-function.d.ts +5 -2
- package/dist/guard-types/check-wrap-wrapper-function.d.ts +4 -1
- package/dist/guard-types/guard-group.d.ts +7 -8
- package/dist/guard-types/wait-until-function.d.ts +8 -3
- package/dist/guard-types/wait-until-function.js +1 -1
- package/package.json +21 -8
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* (the optional user-defined failure message for any assertion).
|
|
7
7
|
*
|
|
8
8
|
* @category Assert : Util
|
|
9
|
+
* @category Package : @augment-vir/assert
|
|
9
10
|
* @example
|
|
10
11
|
*
|
|
11
12
|
* ```ts
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
* throw new AssertionError('The assertion failed.', 'User defined message.');
|
|
16
17
|
* ```
|
|
17
18
|
*
|
|
18
|
-
* @package
|
|
19
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
19
20
|
*/
|
|
20
21
|
export declare class AssertionError extends Error {
|
|
21
22
|
name: string;
|
|
@@ -7,6 +7,7 @@ import { combineErrorMessages } from '@augment-vir/core';
|
|
|
7
7
|
* (the optional user-defined failure message for any assertion).
|
|
8
8
|
*
|
|
9
9
|
* @category Assert : Util
|
|
10
|
+
* @category Package : @augment-vir/assert
|
|
10
11
|
* @example
|
|
11
12
|
*
|
|
12
13
|
* ```ts
|
|
@@ -16,7 +17,7 @@ import { combineErrorMessages } from '@augment-vir/core';
|
|
|
16
17
|
* throw new AssertionError('The assertion failed.', 'User defined message.');
|
|
17
18
|
* ```
|
|
18
19
|
*
|
|
19
|
-
* @package
|
|
20
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
20
21
|
*/
|
|
21
22
|
export class AssertionError extends Error {
|
|
22
23
|
name = 'AssertionError';
|
|
@@ -1,33 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* A group of guard methods that do the following:
|
|
3
|
-
*
|
|
4
|
-
* 1. Run the method's assertion on the given inputs.
|
|
5
|
-
* 2. If the assertion fails, throws an error.
|
|
6
|
-
* 3. If the assertion succeeds, the first input is returned and (when possible) type guarded.
|
|
7
|
-
*
|
|
8
|
-
* @category Assert
|
|
9
|
-
* @example
|
|
10
|
-
*
|
|
11
|
-
* ```ts
|
|
12
|
-
* import {assertWrap} from '@augment-vir/assert';
|
|
13
|
-
*
|
|
14
|
-
* // `result1` will be `['a']`
|
|
15
|
-
* const result1 = assertWrap.deepEquals(['a'], ['a']);
|
|
16
|
-
*
|
|
17
|
-
* const value: unknown = 'some value' as unknown;
|
|
18
|
-
* // `result2` will be `'some value'` and it will have the type of `string`
|
|
19
|
-
* const result2 = assertWrap.isString(value);
|
|
20
|
-
*
|
|
21
|
-
* const value2: unknown = 'some value' as unknown;
|
|
22
|
-
* // this will throw an error
|
|
23
|
-
* const result3 = assertWrap.isNumber(value2);
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @returns The original value if expectations are met.
|
|
27
|
-
* @throws {@link AssertionError} When the assertion fails.
|
|
28
|
-
* @package @augment-vir/assert
|
|
29
|
-
*/
|
|
30
|
-
export declare const assertWrap: import("../../guard-types/assert-wrap-function.js").AssertWrapGroup<{
|
|
1
|
+
declare const assertWrapGroup: import("../../guard-types/assert-wrap-function.js").AssertWrapGroup<{
|
|
31
2
|
output: {
|
|
32
3
|
<const FunctionToCall extends import("@augment-vir/core").AnyFunction>(functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<NoInfer<FunctionToCall>>> extends true ? void : Promise<void> : void;
|
|
33
4
|
<const FunctionToCall extends import("@augment-vir/core").AnyFunction>(asserter: import("../assertion-exports.js").CustomOutputAsserter<NoInfer<FunctionToCall>>, functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<NoInfer<FunctionToCall>>> extends true ? void : Promise<void> : void;
|
|
@@ -44,13 +15,13 @@ export declare const assertWrap: import("../../guard-types/assert-wrap-function.
|
|
|
44
15
|
isNotEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("../assertion-exports.js").Empty>;
|
|
45
16
|
isUuid: (actual: unknown, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").Uuid;
|
|
46
17
|
isNotUuid: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").Uuid>;
|
|
47
|
-
isError: (actual: unknown, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined) => asserts actual is Error;
|
|
48
18
|
throws: {
|
|
49
19
|
(callbackOrPromise: import("@augment-vir/core").TypedFunction<void, never>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): void;
|
|
50
20
|
(callbackOrPromise: import("@augment-vir/core").TypedFunction<void, Promise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): Promise<void>;
|
|
51
21
|
(callback: import("@augment-vir/core").TypedFunction<void, any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): void;
|
|
52
22
|
(callback: import("@augment-vir/core").TypedFunction<void, import("@augment-vir/core").MaybePromise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): import("@augment-vir/core").MaybePromise<void>;
|
|
53
23
|
};
|
|
24
|
+
isError: (actual: unknown, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined) => asserts actual is Error;
|
|
54
25
|
strictEquals: typeof import("../../assertions/equality/simple-equality.js").strictEquals;
|
|
55
26
|
notStrictEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
|
|
56
27
|
looseEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
|
|
@@ -71,12 +42,12 @@ export declare const assertWrap: import("../../guard-types/assert-wrap-function.
|
|
|
71
42
|
isNotBigInt: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, bigint>;
|
|
72
43
|
isNotBoolean: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, boolean>;
|
|
73
44
|
isNotFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").AnyFunction>;
|
|
45
|
+
isNotNull: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, null>;
|
|
74
46
|
isNotNumber: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, number>;
|
|
75
47
|
isNotObject: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").UnknownObject>;
|
|
76
48
|
isNotString: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, string>;
|
|
77
49
|
isNotSymbol: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, symbol>;
|
|
78
50
|
isNotUndefined: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, undefined>;
|
|
79
|
-
isNotNull: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, null>;
|
|
80
51
|
matches: (actual: string, expected: RegExp, failureMessage?: string | undefined) => void;
|
|
81
52
|
mismatches: (actual: string, expected: RegExp, failureMessage?: string | undefined) => void;
|
|
82
53
|
isPromiseLike: (actual: unknown, failureMessage?: string | undefined) => asserts actual is PromiseLike<any>;
|
|
@@ -140,24 +111,38 @@ export declare const assertWrap: import("../../guard-types/assert-wrap-function.
|
|
|
140
111
|
(parent: string, child: string, failureMessage?: string | undefined): void;
|
|
141
112
|
(parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): void;
|
|
142
113
|
};
|
|
114
|
+
isFalse: (input: unknown, failureMessage?: string | undefined) => asserts input is false;
|
|
143
115
|
isFalsy: (input: unknown, failureMessage?: string | undefined) => asserts input is import("../assertion-exports.js").FalsyValue;
|
|
144
|
-
isTruthy: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is import("../assertion-exports.js").Truthy<Actual>;
|
|
145
116
|
isTrue: (input: unknown, failureMessage?: string | undefined) => asserts input is true;
|
|
146
|
-
|
|
117
|
+
isTruthy: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is import("../assertion-exports.js").Truthy<Actual>;
|
|
147
118
|
}, {
|
|
119
|
+
isFalse: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
148
120
|
isFalsy: <T>(input: T, failureMessage?: string | undefined) => import("../assertion-exports.js").Falsy<T>;
|
|
121
|
+
isTrue: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
149
122
|
isTruthy: <T>(input: T, failureMessage?: string | undefined) => import("../assertion-exports.js").Truthy<T>;
|
|
150
123
|
} & {
|
|
151
124
|
strictEquals: <Actual, Expected extends Actual>(actual: Actual, expected: Expected, failureMessage?: string | undefined) => import("@augment-vir/core").NarrowToExpected<Actual, Expected>;
|
|
125
|
+
notStrictEquals: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
126
|
+
looseEquals: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
127
|
+
notLooseEquals: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
152
128
|
deepEquals: <Actual, Expected extends Actual>(actual: Actual, expected: Expected, failureMessage?: string | undefined) => import("@augment-vir/core").NarrowToExpected<Actual, Expected>;
|
|
129
|
+
notDeepEquals: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
153
130
|
} & {
|
|
154
131
|
output: {
|
|
155
132
|
<const FunctionToCall extends import("@augment-vir/core").AnyFunction>(functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<FunctionToCall>> extends true ? Awaited<ReturnType<NoInfer<FunctionToCall>>> : Promise<Awaited<ReturnType<NoInfer<FunctionToCall>>>> : Awaited<ReturnType<NoInfer<FunctionToCall>>>;
|
|
156
133
|
<const FunctionToCall extends import("@augment-vir/core").AnyFunction>(asserter: import("../assertion-exports.js").CustomOutputAsserter<NoInfer<FunctionToCall>>, functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<FunctionToCall>> extends true ? Awaited<ReturnType<NoInfer<FunctionToCall>>> : Promise<Awaited<ReturnType<NoInfer<FunctionToCall>>>> : Awaited<ReturnType<NoInfer<FunctionToCall>>>;
|
|
157
134
|
};
|
|
158
135
|
} & {
|
|
136
|
+
isArray: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
137
|
+
isBigInt: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
138
|
+
isBoolean: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
159
139
|
isFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => import("@augment-vir/core").NarrowToActual<Actual, import("@augment-vir/core").AnyFunction>;
|
|
140
|
+
isNull: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
141
|
+
isNumber: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
142
|
+
isObject: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
143
|
+
isString: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
160
144
|
isSymbol: <const Actual>(actual: Actual, failureMessage?: string | undefined) => import("@augment-vir/core").NarrowToExpected<Actual, symbol>;
|
|
145
|
+
isUndefined: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
161
146
|
isNotArray: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, ReadonlyArray<unknown>>;
|
|
162
147
|
isNotBigInt: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, bigint>;
|
|
163
148
|
isNotBoolean: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, boolean>;
|
|
@@ -166,8 +151,8 @@ export declare const assertWrap: import("../../guard-types/assert-wrap-function.
|
|
|
166
151
|
isNotNumber: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, number>;
|
|
167
152
|
isNotObject: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, import("@augment-vir/core").UnknownObject>;
|
|
168
153
|
isNotString: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, string>;
|
|
169
|
-
isNotUndefined: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, undefined>;
|
|
170
154
|
isNotSymbol: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, symbol>;
|
|
155
|
+
isNotUndefined: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, undefined>;
|
|
171
156
|
} & {
|
|
172
157
|
throws: {
|
|
173
158
|
(callbackOrPromise: import("@augment-vir/core").TypedFunction<void, never>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): Error;
|
|
@@ -175,7 +160,12 @@ export declare const assertWrap: import("../../guard-types/assert-wrap-function.
|
|
|
175
160
|
(callback: import("@augment-vir/core").TypedFunction<void, any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): Error;
|
|
176
161
|
(callback: import("@augment-vir/core").TypedFunction<void, import("@augment-vir/core").MaybePromise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): import("@augment-vir/core").MaybePromise<Error>;
|
|
177
162
|
};
|
|
163
|
+
isError: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
178
164
|
} & {
|
|
165
|
+
hasValue: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
166
|
+
lacksValue: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
167
|
+
hasValues: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
168
|
+
lacksValues: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
179
169
|
isIn: <const Child, const Parent>(child: Child, parent: Parent, failureMessage?: string | undefined) => import("@augment-vir/core").NarrowToExpected<Child, import("@augment-vir/core").Values<Parent>>;
|
|
180
170
|
isNotIn: <const Parent, const Child>(child: Child, parent: Parent, failureMessage?: string | undefined) => Exclude<Child, import("@augment-vir/core").Values<Parent>>;
|
|
181
171
|
isEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual, failureMessage?: string | undefined) => import("@augment-vir/core").NarrowToActual<Actual, import("../assertion-exports.js").Empty>;
|
|
@@ -206,9 +196,12 @@ export declare const assertWrap: import("../../guard-types/assert-wrap-function.
|
|
|
206
196
|
isNotEnumValue: <const Actual, const Expected extends import("@augment-vir/core").EnumBaseType>(child: Actual, checkEnum: Expected, failureMessage?: string | undefined) => Exclude<Actual, Expected[keyof Expected] | `${Expected[keyof Expected]}`>;
|
|
207
197
|
} & {
|
|
208
198
|
entriesEqual: <Actual, Expected extends Actual>(actual: Actual, expected: Expected, failureMessage?: string | undefined) => import("@augment-vir/core").NarrowToExpected<Actual, Expected>;
|
|
199
|
+
notEntriesEqual: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
209
200
|
} & {
|
|
210
201
|
jsonEquals: <Actual, Expected extends Actual>(actual: Actual, expected: Expected, failureMessage?: string | undefined) => import("@augment-vir/core").NarrowToExpected<Actual, Expected>;
|
|
202
|
+
notJsonEquals: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
211
203
|
} & {
|
|
204
|
+
isHttpStatus: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
212
205
|
isHttpStatusCategory: <const Actual, const Category extends import("@augment-vir/core").HttpStatusCategory>(actual: Actual, category: Category, failureMessage?: string | undefined) => import("@augment-vir/core").NarrowToExpected<Actual, import("@augment-vir/core").HttpStatusByCategory<Category>>;
|
|
213
206
|
} & {
|
|
214
207
|
instanceOf: <const Instance>(instance: unknown, constructor: import("type-fest").Constructor<Instance>, failureMessage?: string | undefined) => Instance;
|
|
@@ -231,14 +224,66 @@ export declare const assertWrap: import("../../guard-types/assert-wrap-function.
|
|
|
231
224
|
};
|
|
232
225
|
} & {
|
|
233
226
|
isDefined: <Actual>(input: Actual, failureMessage?: string | undefined) => Exclude<Actual, undefined | null>;
|
|
227
|
+
isNullish: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
228
|
+
} & {
|
|
229
|
+
isAbove: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
230
|
+
isAtLeast: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
231
|
+
isBelow: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
232
|
+
isAtMost: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
233
|
+
isNaN: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
234
|
+
isFinite: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
235
|
+
isInfinite: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
236
|
+
isApproximately: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
237
|
+
isNotApproximately: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
234
238
|
} & {
|
|
235
239
|
isNotPrimitive: <const Actual>(input: Actual, failureMessage?: string | undefined) => Exclude<Actual, import("type-fest").Primitive>;
|
|
236
240
|
isNotPropertyKey: <const Actual>(input: Actual, failureMessage?: string | undefined) => Exclude<Actual, PropertyKey>;
|
|
241
|
+
isPrimitive: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
242
|
+
isPropertyKey: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
237
243
|
} & {
|
|
238
|
-
isPromise: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Extract<Actual, Promise<any>>;
|
|
239
|
-
isNotPromise: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, Promise<any>>;
|
|
240
244
|
isPromiseLike: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Extract<Actual, PromiseLike<any>>;
|
|
241
245
|
isNotPromiseLike: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, PromiseLike<any>>;
|
|
246
|
+
isPromise: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Extract<Actual, Promise<any>>;
|
|
247
|
+
isNotPromise: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, Promise<any>>;
|
|
248
|
+
} & {
|
|
249
|
+
matches: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
250
|
+
mismatches: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
242
251
|
} & {
|
|
252
|
+
isUuid: typeof import("../../guard-types/guard-override.js").autoGuardSymbol;
|
|
243
253
|
isNotUuid: <const Actual>(actual: Actual, failureMessage?: string | undefined) => Exclude<Actual, import("@augment-vir/core").Uuid>;
|
|
244
254
|
}>;
|
|
255
|
+
/**
|
|
256
|
+
* A group of guard methods that do the following:
|
|
257
|
+
*
|
|
258
|
+
* 1. Run the method's assertion on the given inputs.
|
|
259
|
+
* 2. If the assertion fails, throws an error.
|
|
260
|
+
* 3. If the assertion succeeds, the first input is returned and (when possible) type guarded.
|
|
261
|
+
*
|
|
262
|
+
* This can also be called as a standalone assertion function which asserts that its input is truthy
|
|
263
|
+
* and returns it if so.
|
|
264
|
+
*
|
|
265
|
+
* @category Assert
|
|
266
|
+
* @category Package : @augment-vir/assert
|
|
267
|
+
* @example
|
|
268
|
+
*
|
|
269
|
+
* ```ts
|
|
270
|
+
* import {assertWrap} from '@augment-vir/assert';
|
|
271
|
+
*
|
|
272
|
+
* // `result1` will be `['a']`
|
|
273
|
+
* const result1 = assertWrap.deepEquals(['a'], ['a']);
|
|
274
|
+
*
|
|
275
|
+
* const value: unknown = 'some value' as unknown;
|
|
276
|
+
* // `result2` will be `'some value'` and it will have the type of `string`
|
|
277
|
+
* const result2 = assertWrap.isString(value);
|
|
278
|
+
*
|
|
279
|
+
* const value2: unknown = 'some value' as unknown;
|
|
280
|
+
* // this will throw an error
|
|
281
|
+
* const result3 = assertWrap.isNumber(value2);
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* @returns The original value if expectations are met.
|
|
285
|
+
* @throws {@link AssertionError} When the assertion fails.
|
|
286
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
287
|
+
*/
|
|
288
|
+
export declare const assertWrap: (<T>(input: T, failureMessage?: string | undefined) => T) & typeof assertWrapGroup;
|
|
289
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { assertWrapOverrides, extendableAssertions } from '../../assertions/extendable-assertions.js';
|
|
2
2
|
import { createAssertWrapGroup } from '../../guard-types/assert-wrap-function.js';
|
|
3
|
+
import { AssertionError } from '../assertion.error.js';
|
|
4
|
+
const assertWrapGroup = createAssertWrapGroup(extendableAssertions, assertWrapOverrides);
|
|
3
5
|
/**
|
|
4
6
|
* A group of guard methods that do the following:
|
|
5
7
|
*
|
|
@@ -7,7 +9,11 @@ import { createAssertWrapGroup } from '../../guard-types/assert-wrap-function.js
|
|
|
7
9
|
* 2. If the assertion fails, throws an error.
|
|
8
10
|
* 3. If the assertion succeeds, the first input is returned and (when possible) type guarded.
|
|
9
11
|
*
|
|
12
|
+
* This can also be called as a standalone assertion function which asserts that its input is truthy
|
|
13
|
+
* and returns it if so.
|
|
14
|
+
*
|
|
10
15
|
* @category Assert
|
|
16
|
+
* @category Package : @augment-vir/assert
|
|
11
17
|
* @example
|
|
12
18
|
*
|
|
13
19
|
* ```ts
|
|
@@ -27,6 +33,11 @@ import { createAssertWrapGroup } from '../../guard-types/assert-wrap-function.js
|
|
|
27
33
|
*
|
|
28
34
|
* @returns The original value if expectations are met.
|
|
29
35
|
* @throws {@link AssertionError} When the assertion fails.
|
|
30
|
-
* @package
|
|
36
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
31
37
|
*/
|
|
32
|
-
export const assertWrap =
|
|
38
|
+
export const assertWrap = Object.assign(function assertWrap(input, failureMessage) {
|
|
39
|
+
if (!input) {
|
|
40
|
+
throw new AssertionError('Assertion failed.', failureMessage);
|
|
41
|
+
}
|
|
42
|
+
return input;
|
|
43
|
+
}, assertWrapGroup);
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import type { AnyFunction } from '@augment-vir/core';
|
|
2
1
|
declare const allAssertions: {
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Immediately throw an assertion error.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import {assert} from '@augment-vir/assert';
|
|
9
|
+
*
|
|
10
|
+
* assert.fail(); // throws an `AssertionError`
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @throws {@link AssertionError}
|
|
14
|
+
*/
|
|
15
|
+
fail: (failureMessage?: string | undefined) => never;
|
|
4
16
|
output: {
|
|
5
|
-
<const FunctionToCall extends AnyFunction>(functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<NoInfer<FunctionToCall>>> extends true ? void : Promise<void> : void;
|
|
6
|
-
<const FunctionToCall extends AnyFunction>(asserter: import("../assertion-exports.js").CustomOutputAsserter<NoInfer<FunctionToCall>>, functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<NoInfer<FunctionToCall>>> extends true ? void : Promise<void> : void;
|
|
17
|
+
<const FunctionToCall extends import("@augment-vir/core").AnyFunction>(functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<NoInfer<FunctionToCall>>> extends true ? void : Promise<void> : void;
|
|
18
|
+
<const FunctionToCall extends import("@augment-vir/core").AnyFunction>(asserter: import("../assertion-exports.js").CustomOutputAsserter<NoInfer<FunctionToCall>>, functionToCall: FunctionToCall, inputs: Parameters<NoInfer<FunctionToCall>>, expectedOutput: Awaited<ReturnType<NoInfer<FunctionToCall>>>, failureMessage?: string | undefined): Promise<any> extends ReturnType<NoInfer<FunctionToCall>> ? import("type-fest").IsAny<ReturnType<NoInfer<FunctionToCall>>> extends true ? void : Promise<void> : void;
|
|
7
19
|
};
|
|
8
20
|
isHttpStatus: (actual: unknown, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").HttpStatus;
|
|
9
21
|
isHttpStatusCategory: <const Actual, const Category extends import("@augment-vir/core").HttpStatusCategory>(actual: Actual, category: Category, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").NarrowToExpected<Actual, import("@augment-vir/core").HttpStatusByCategory<Category>>;
|
|
@@ -17,13 +29,13 @@ declare const allAssertions: {
|
|
|
17
29
|
isNotEmpty: <const Actual extends import("../assertion-exports.js").CanBeEmpty>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("../assertion-exports.js").Empty>;
|
|
18
30
|
isUuid: (actual: unknown, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").Uuid;
|
|
19
31
|
isNotUuid: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").Uuid>;
|
|
20
|
-
isError: (actual: unknown, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined) => asserts actual is Error;
|
|
21
32
|
throws: {
|
|
22
33
|
(callbackOrPromise: import("@augment-vir/core").TypedFunction<void, never>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): void;
|
|
23
34
|
(callbackOrPromise: import("@augment-vir/core").TypedFunction<void, Promise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): Promise<void>;
|
|
24
35
|
(callback: import("@augment-vir/core").TypedFunction<void, any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): void;
|
|
25
36
|
(callback: import("@augment-vir/core").TypedFunction<void, import("@augment-vir/core").MaybePromise<any>> | Promise<any>, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined): import("@augment-vir/core").MaybePromise<void>;
|
|
26
37
|
};
|
|
38
|
+
isError: (actual: unknown, matchOptions?: import("../assertion-exports.js").ErrorMatchOptions | undefined, failureMessage?: string | undefined) => asserts actual is Error;
|
|
27
39
|
strictEquals: typeof import("../../assertions/equality/simple-equality.js").strictEquals;
|
|
28
40
|
notStrictEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
|
|
29
41
|
looseEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
|
|
@@ -33,7 +45,7 @@ declare const allAssertions: {
|
|
|
33
45
|
isArray: (actual: unknown, failureMessage?: string | undefined) => asserts actual is unknown[];
|
|
34
46
|
isBigInt: (actual: unknown, failureMessage?: string | undefined) => asserts actual is bigint;
|
|
35
47
|
isBoolean: (actual: unknown, failureMessage?: string | undefined) => asserts actual is boolean;
|
|
36
|
-
isFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").NarrowToActual<Actual, AnyFunction>;
|
|
48
|
+
isFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").NarrowToActual<Actual, import("@augment-vir/core").AnyFunction>;
|
|
37
49
|
isNull: (actual: unknown, failureMessage?: string | undefined) => asserts actual is null;
|
|
38
50
|
isNumber: (actual: unknown, failureMessage?: string | undefined) => asserts actual is number;
|
|
39
51
|
isObject: (actual: unknown, failureMessage?: string | undefined) => asserts actual is import("@augment-vir/core").UnknownObject;
|
|
@@ -43,13 +55,13 @@ declare const allAssertions: {
|
|
|
43
55
|
isNotArray: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, ReadonlyArray<unknown>>;
|
|
44
56
|
isNotBigInt: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, bigint>;
|
|
45
57
|
isNotBoolean: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, boolean>;
|
|
46
|
-
isNotFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, AnyFunction>;
|
|
58
|
+
isNotFunction: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").AnyFunction>;
|
|
59
|
+
isNotNull: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, null>;
|
|
47
60
|
isNotNumber: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, number>;
|
|
48
61
|
isNotObject: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, import("@augment-vir/core").UnknownObject>;
|
|
49
62
|
isNotString: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, string>;
|
|
50
63
|
isNotSymbol: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, symbol>;
|
|
51
64
|
isNotUndefined: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, undefined>;
|
|
52
|
-
isNotNull: <const Actual>(actual: Actual, failureMessage?: string | undefined) => asserts actual is Exclude<Actual, null>;
|
|
53
65
|
matches: (actual: string, expected: RegExp, failureMessage?: string | undefined) => void;
|
|
54
66
|
mismatches: (actual: string, expected: RegExp, failureMessage?: string | undefined) => void;
|
|
55
67
|
isPromiseLike: (actual: unknown, failureMessage?: string | undefined) => asserts actual is PromiseLike<any>;
|
|
@@ -81,9 +93,9 @@ declare const allAssertions: {
|
|
|
81
93
|
};
|
|
82
94
|
isKeyOf: <const Parent>(key: PropertyKey, parent: Parent, failureMessage?: string | undefined) => asserts key is keyof Parent;
|
|
83
95
|
isNotKeyOf: <const Key extends PropertyKey, const Parent>(key: Key, parent: Parent, failureMessage?: string | undefined) => asserts key is Exclude<Key, import("@augment-vir/core").RequiredKeysOf<Parent>>;
|
|
84
|
-
hasKey: <const Key extends PropertyKey, const Parent>(parent: Parent, key: Key, failureMessage?: string | undefined) => asserts parent is Parent & Record<Key, (Key extends keyof Parent ? import("
|
|
96
|
+
hasKey: <const Key extends PropertyKey, const Parent>(parent: Parent, key: Key, failureMessage?: string | undefined) => asserts parent is Parent & Record<Key, (Key extends keyof Parent ? import("type-fest").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never) extends never ? unknown : Key extends keyof Parent ? import("type-fest").SetRequired<Parent, Key>[Key] : Key extends keyof Extract<Parent, Record<Key, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Key, any>>, Key>[Key] : never>;
|
|
85
97
|
lacksKey: <const Parent, const Key extends PropertyKey>(parent: Parent, key: Key, failureMessage?: string | undefined) => asserts parent is Exclude<Parent, Record<Key, any>>;
|
|
86
|
-
hasKeys: <const Keys extends PropertyKey, const Parent>(parent: Parent, keys: ReadonlyArray<Keys>, failureMessage?: string | undefined) => asserts parent is Parent & Record<Keys, (Keys extends keyof Parent ? import("
|
|
98
|
+
hasKeys: <const Keys extends PropertyKey, const Parent>(parent: Parent, keys: ReadonlyArray<Keys>, failureMessage?: string | undefined) => asserts parent is Parent & Record<Keys, (Keys extends keyof Parent ? import("type-fest").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never) extends never ? unknown : Keys extends keyof Parent ? import("type-fest").SetRequired<Parent, Keys>[Keys] : Keys extends keyof Extract<Parent, Record<Keys, any>> ? import("type-fest").SetRequired<Extract<Parent, Record<Keys, any>>, Keys>[Keys] : never>;
|
|
87
99
|
lacksKeys: <const Parent, const Key extends PropertyKey>(parent: Parent, keys: ReadonlyArray<Key>, failureMessage?: string | undefined) => asserts parent is Exclude<Parent, Partial<Record<Key, any>>>;
|
|
88
100
|
jsonEquals: <const Actual, const Expected extends Actual>(actual: Actual, expected: Expected, failureMessage?: string | undefined) => asserts actual is Expected;
|
|
89
101
|
notJsonEquals: (actual: unknown, expected: unknown, failureMessage?: string | undefined) => void;
|
|
@@ -113,10 +125,10 @@ declare const allAssertions: {
|
|
|
113
125
|
(parent: string, child: string, failureMessage?: string | undefined): void;
|
|
114
126
|
(parent: string | ReadonlyArray<string>, child: string, failureMessage?: string | undefined): void;
|
|
115
127
|
};
|
|
128
|
+
isFalse: (input: unknown, failureMessage?: string | undefined) => asserts input is false;
|
|
116
129
|
isFalsy: (input: unknown, failureMessage?: string | undefined) => asserts input is import("../assertion-exports.js").FalsyValue;
|
|
117
|
-
isTruthy: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is import("../assertion-exports.js").Truthy<Actual>;
|
|
118
130
|
isTrue: (input: unknown, failureMessage?: string | undefined) => asserts input is true;
|
|
119
|
-
|
|
131
|
+
isTruthy: <const Actual>(input: Actual, failureMessage?: string | undefined) => asserts input is import("../assertion-exports.js").Truthy<Actual>;
|
|
120
132
|
tsType: {
|
|
121
133
|
<Actual>(input: Actual): {
|
|
122
134
|
equals: {
|
|
@@ -159,7 +171,11 @@ declare const allAssertions: {
|
|
|
159
171
|
/**
|
|
160
172
|
* A group of guard methods that assert their conditions and do nothing else.
|
|
161
173
|
*
|
|
174
|
+
* This can also be called as a standalone assertion function which asserts that its input is
|
|
175
|
+
* truthy.
|
|
176
|
+
*
|
|
162
177
|
* @category Assert
|
|
178
|
+
* @category Package : @augment-vir/assert
|
|
163
179
|
* @example
|
|
164
180
|
*
|
|
165
181
|
* ```ts
|
|
@@ -171,7 +187,7 @@ declare const allAssertions: {
|
|
|
171
187
|
* ```
|
|
172
188
|
*
|
|
173
189
|
* @throws {@link AssertionError} When the assertion fails.
|
|
174
|
-
* @package
|
|
190
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
175
191
|
*/
|
|
176
|
-
export declare const assert: ((input: unknown, failureMessage?: string | undefined) => void) & typeof allAssertions
|
|
192
|
+
export declare const assert: ((input: unknown, failureMessage?: string | undefined) => void) & typeof allAssertions;
|
|
177
193
|
export {};
|
|
@@ -2,16 +2,33 @@ import { tsTypeGuards } from '../../assertions/equality/ts-type-equality.js';
|
|
|
2
2
|
import { extendableAssertions } from '../../assertions/extendable-assertions.js';
|
|
3
3
|
import { AssertionError } from '../assertion.error.js';
|
|
4
4
|
const allAssertions = {
|
|
5
|
-
...tsTypeGuards.
|
|
5
|
+
...tsTypeGuards.assert,
|
|
6
6
|
...extendableAssertions,
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Immediately throw an assertion error.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* import {assert} from '@augment-vir/assert';
|
|
14
|
+
*
|
|
15
|
+
* assert.fail(); // throws an `AssertionError`
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @throws {@link AssertionError}
|
|
19
|
+
*/
|
|
20
|
+
fail: (failureMessage) => {
|
|
8
21
|
throw new AssertionError('Failure triggered.', failureMessage);
|
|
9
22
|
},
|
|
10
23
|
};
|
|
11
24
|
/**
|
|
12
25
|
* A group of guard methods that assert their conditions and do nothing else.
|
|
13
26
|
*
|
|
27
|
+
* This can also be called as a standalone assertion function which asserts that its input is
|
|
28
|
+
* truthy.
|
|
29
|
+
*
|
|
14
30
|
* @category Assert
|
|
31
|
+
* @category Package : @augment-vir/assert
|
|
15
32
|
* @example
|
|
16
33
|
*
|
|
17
34
|
* ```ts
|
|
@@ -23,9 +40,9 @@ const allAssertions = {
|
|
|
23
40
|
* ```
|
|
24
41
|
*
|
|
25
42
|
* @throws {@link AssertionError} When the assertion fails.
|
|
26
|
-
* @package
|
|
43
|
+
* @package [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert)
|
|
27
44
|
*/
|
|
28
|
-
export const assert = Object.assign((input, failureMessage)
|
|
45
|
+
export const assert = Object.assign(function assert(input, failureMessage) {
|
|
29
46
|
if (!input) {
|
|
30
47
|
throw new AssertionError('Assertion failed.', failureMessage);
|
|
31
48
|
}
|