assertron 11.5.2 → 11.5.4
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 +7 -7
- package/cjs/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/defineProperty.js +12 -0
- package/cjs/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/toPrimitive.js +14 -0
- package/cjs/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/toPropertyKey.js +9 -0
- package/cjs/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/typeof.js +16 -0
- package/cjs/_virtual/_rolldown/runtime.js +23 -0
- package/cjs/assert-order/AssertOrder.d.ts +42 -39
- package/cjs/assert-order/AssertOrder.d.ts.map +1 -1
- package/cjs/assert-order/AssertOrder.js +118 -146
- package/cjs/assert-order/AssertOrder.js.map +1 -1
- package/cjs/assert-order/InvalidOrder.d.ts +10 -7
- package/cjs/assert-order/InvalidOrder.d.ts.map +1 -1
- package/cjs/assert-order/InvalidOrder.js +24 -43
- package/cjs/assert-order/InvalidOrder.js.map +1 -1
- package/cjs/assert-order/StateMachine.js +101 -156
- package/cjs/assert-order/StateMachine.js.map +1 -1
- package/cjs/assert-order/index.d.ts +4 -4
- package/cjs/assert-order/types.d.ts +9 -6
- package/cjs/assert-order/types.d.ts.map +1 -1
- package/cjs/assertron/assertron.d.ts +23 -20
- package/cjs/assertron/assertron.d.ts.map +1 -1
- package/cjs/assertron/assertron.js +36 -39
- package/cjs/assertron/assertron.js.map +1 -1
- package/cjs/assertron/falsy.js +5 -6
- package/cjs/assertron/falsy.js.map +1 -1
- package/cjs/assertron/index.d.ts +3 -3
- package/cjs/assertron/isInstanceof.js +6 -7
- package/cjs/assertron/isInstanceof.js.map +1 -1
- package/cjs/assertron/pathEqual.js +7 -8
- package/cjs/assertron/pathEqual.js.map +1 -1
- package/cjs/assertron/rejects.js +8 -8
- package/cjs/assertron/rejects.js.map +1 -1
- package/cjs/assertron/repeat.js +23 -31
- package/cjs/assertron/repeat.js.map +1 -1
- package/cjs/assertron/resolves.js +8 -8
- package/cjs/assertron/resolves.js.map +1 -1
- package/cjs/assertron/satisfies.d.ts +5 -10
- package/cjs/assertron/satisfies.d.ts.map +1 -1
- package/cjs/assertron/satisfies.js +12 -14
- package/cjs/assertron/satisfies.js.map +1 -1
- package/cjs/assertron/throws.js +48 -55
- package/cjs/assertron/throws.js.map +1 -1
- package/cjs/assertron/truthy.js +5 -6
- package/cjs/assertron/truthy.js.map +1 -1
- package/cjs/errors.d.ts +13 -10
- package/cjs/errors.d.ts.map +1 -1
- package/cjs/errors.js +19 -29
- package/cjs/errors.js.map +1 -1
- package/cjs/index.d.ts +10 -8
- package/cjs/index.js +98 -37
- package/cjs/index.js.map +1 -1
- package/cjs/package.json +3 -1
- package/cjs/types.d.ts +5 -2
- package/cjs/types.d.ts.map +1 -1
- package/cjs/utils/index.js +18 -25
- package/cjs/utils/index.js.map +1 -1
- package/cjs/utils/isErrorConstructor.js +4 -4
- package/cjs/utils/isErrorConstructor.js.map +1 -1
- package/cjs/utils/notEqualMessage.js +4 -4
- package/cjs/utils/notEqualMessage.js.map +1 -1
- package/cjs/utils/notSatisfiedMessage.js +14 -23
- package/cjs/utils/notSatisfiedMessage.js.map +1 -1
- package/cjs/utils/notThrownMessage.js +5 -5
- package/cjs/utils/notThrownMessage.js.map +1 -1
- package/cjs/utils/promiseMessages.js +7 -13
- package/cjs/utils/promiseMessages.js.map +1 -1
- package/cjs/utils/unexpectedErrorMessage.js +6 -6
- package/cjs/utils/unexpectedErrorMessage.js.map +1 -1
- package/esm/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/defineProperty.js +12 -0
- package/esm/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/toPrimitive.js +14 -0
- package/esm/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/toPropertyKey.js +9 -0
- package/esm/_virtual/_@oxc-project_runtime@0.147.0/helpers/esm/typeof.js +11 -0
- package/esm/assert-order/AssertOrder.d.ts +42 -39
- package/esm/assert-order/AssertOrder.d.ts.map +1 -1
- package/esm/assert-order/AssertOrder.js +119 -143
- package/esm/assert-order/AssertOrder.js.map +1 -1
- package/esm/assert-order/InvalidOrder.d.ts +10 -7
- package/esm/assert-order/InvalidOrder.d.ts.map +1 -1
- package/esm/assert-order/InvalidOrder.js +24 -39
- package/esm/assert-order/InvalidOrder.js.map +1 -1
- package/esm/assert-order/StateMachine.js +99 -129
- package/esm/assert-order/StateMachine.js.map +1 -1
- package/esm/assert-order/index.d.ts +4 -4
- package/esm/assert-order/types.d.ts +9 -6
- package/esm/assert-order/types.d.ts.map +1 -1
- package/esm/assertron/assertron.d.ts +23 -20
- package/esm/assertron/assertron.d.ts.map +1 -1
- package/esm/assertron/assertron.js +36 -36
- package/esm/assertron/assertron.js.map +1 -1
- package/esm/assertron/falsy.js +7 -4
- package/esm/assertron/falsy.js.map +1 -1
- package/esm/assertron/index.d.ts +3 -3
- package/esm/assertron/isInstanceof.js +8 -5
- package/esm/assertron/isInstanceof.js.map +1 -1
- package/esm/assertron/pathEqual.js +9 -6
- package/esm/assertron/pathEqual.js.map +1 -1
- package/esm/assertron/rejects.js +10 -6
- package/esm/assertron/rejects.js.map +1 -1
- package/esm/assertron/repeat.js +22 -25
- package/esm/assertron/repeat.js.map +1 -1
- package/esm/assertron/resolves.js +10 -6
- package/esm/assertron/resolves.js.map +1 -1
- package/esm/assertron/satisfies.d.ts +5 -10
- package/esm/assertron/satisfies.d.ts.map +1 -1
- package/esm/assertron/satisfies.js +14 -12
- package/esm/assertron/satisfies.js.map +1 -1
- package/esm/assertron/throws.js +47 -49
- package/esm/assertron/throws.js.map +1 -1
- package/esm/assertron/truthy.js +7 -4
- package/esm/assertron/truthy.js.map +1 -1
- package/esm/errors.d.ts +13 -10
- package/esm/errors.d.ts.map +1 -1
- package/esm/errors.js +20 -26
- package/esm/errors.js.map +1 -1
- package/esm/index.d.ts +10 -8
- package/esm/index.js +10 -7
- package/esm/index.js.map +1 -1
- package/esm/types.d.ts +5 -2
- package/esm/types.d.ts.map +1 -1
- package/esm/utils/index.js +13 -9
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/isErrorConstructor.js +6 -2
- package/esm/utils/isErrorConstructor.js.map +1 -1
- package/esm/utils/notEqualMessage.js +6 -2
- package/esm/utils/notEqualMessage.js.map +1 -1
- package/esm/utils/notSatisfiedMessage.js +15 -20
- package/esm/utils/notSatisfiedMessage.js.map +1 -1
- package/esm/utils/notThrownMessage.js +7 -3
- package/esm/utils/notThrownMessage.js.map +1 -1
- package/esm/utils/promiseMessages.js +9 -11
- package/esm/utils/promiseMessages.js.map +1 -1
- package/esm/utils/unexpectedErrorMessage.js +8 -4
- package/esm/utils/unexpectedErrorMessage.js.map +1 -1
- package/package.json +43 -68
- package/ts/assert-order/AssertOrder.ts +8 -6
- package/ts/assert-order/InvalidOrder.ts +4 -6
- package/ts/assert-order/StateMachine.ts +11 -7
- package/ts/assertron/assertron.ts +9 -19
- package/ts/assertron/falsy.ts +1 -2
- package/ts/assertron/isInstanceof.ts +1 -4
- package/ts/assertron/pathEqual.ts +1 -2
- package/ts/assertron/rejects.ts +2 -2
- package/ts/assertron/repeat.ts +5 -6
- package/ts/assertron/resolves.ts +3 -3
- package/ts/assertron/satisfies.ts +2 -4
- package/ts/assertron/throws.ts +14 -20
- package/ts/assertron/truthy.ts +1 -2
- package/ts/errors.ts +5 -1
- package/ts/index.ts +2 -2
- package/ts/utils/index.ts +1 -1
- package/ts/utils/notSatisfiedMessage.ts +2 -2
- package/ts/utils/promiseMessages.ts +5 -5
- package/cjs/assert-order/StateMachine.d.ts +0 -22
- package/cjs/assert-order/StateMachine.d.ts.map +0 -1
- package/cjs/assert-order/index.d.ts.map +0 -1
- package/cjs/assert-order/index.js +0 -20
- package/cjs/assert-order/index.js.map +0 -1
- package/cjs/assert-order/types.js +0 -3
- package/cjs/assert-order/types.js.map +0 -1
- package/cjs/assertron/falsy.d.ts +0 -2
- package/cjs/assertron/falsy.d.ts.map +0 -1
- package/cjs/assertron/index.d.ts.map +0 -1
- package/cjs/assertron/index.js +0 -18
- package/cjs/assertron/index.js.map +0 -1
- package/cjs/assertron/isInstanceof.d.ts +0 -3
- package/cjs/assertron/isInstanceof.d.ts.map +0 -1
- package/cjs/assertron/pathEqual.d.ts +0 -2
- package/cjs/assertron/pathEqual.d.ts.map +0 -1
- package/cjs/assertron/rejects.d.ts +0 -2
- package/cjs/assertron/rejects.d.ts.map +0 -1
- package/cjs/assertron/repeat.d.ts +0 -6
- package/cjs/assertron/repeat.d.ts.map +0 -1
- package/cjs/assertron/resolves.d.ts +0 -2
- package/cjs/assertron/resolves.d.ts.map +0 -1
- package/cjs/assertron/throws.d.ts +0 -6
- package/cjs/assertron/throws.d.ts.map +0 -1
- package/cjs/assertron/truthy.d.ts +0 -2
- package/cjs/assertron/truthy.d.ts.map +0 -1
- package/cjs/index.d.ts.map +0 -1
- package/cjs/types.js +0 -3
- package/cjs/types.js.map +0 -1
- package/cjs/utils/index.d.ts +0 -8
- package/cjs/utils/index.d.ts.map +0 -1
- package/cjs/utils/isErrorConstructor.d.ts +0 -3
- package/cjs/utils/isErrorConstructor.d.ts.map +0 -1
- package/cjs/utils/notEqualMessage.d.ts +0 -2
- package/cjs/utils/notEqualMessage.d.ts.map +0 -1
- package/cjs/utils/notSatisfiedMessage.d.ts +0 -3
- package/cjs/utils/notSatisfiedMessage.d.ts.map +0 -1
- package/cjs/utils/notThrownMessage.d.ts +0 -2
- package/cjs/utils/notThrownMessage.d.ts.map +0 -1
- package/cjs/utils/promiseMessages.d.ts +0 -3
- package/cjs/utils/promiseMessages.d.ts.map +0 -1
- package/cjs/utils/unexpectedErrorMessage.d.ts +0 -3
- package/cjs/utils/unexpectedErrorMessage.d.ts.map +0 -1
- package/esm/assert-order/StateMachine.d.ts +0 -22
- package/esm/assert-order/StateMachine.d.ts.map +0 -1
- package/esm/assert-order/index.d.ts.map +0 -1
- package/esm/assert-order/index.js +0 -4
- package/esm/assert-order/index.js.map +0 -1
- package/esm/assert-order/types.js +0 -2
- package/esm/assert-order/types.js.map +0 -1
- package/esm/assertron/falsy.d.ts +0 -2
- package/esm/assertron/falsy.d.ts.map +0 -1
- package/esm/assertron/index.d.ts.map +0 -1
- package/esm/assertron/index.js +0 -2
- package/esm/assertron/index.js.map +0 -1
- package/esm/assertron/isInstanceof.d.ts +0 -3
- package/esm/assertron/isInstanceof.d.ts.map +0 -1
- package/esm/assertron/pathEqual.d.ts +0 -2
- package/esm/assertron/pathEqual.d.ts.map +0 -1
- package/esm/assertron/rejects.d.ts +0 -2
- package/esm/assertron/rejects.d.ts.map +0 -1
- package/esm/assertron/repeat.d.ts +0 -6
- package/esm/assertron/repeat.d.ts.map +0 -1
- package/esm/assertron/resolves.d.ts +0 -2
- package/esm/assertron/resolves.d.ts.map +0 -1
- package/esm/assertron/throws.d.ts +0 -6
- package/esm/assertron/throws.d.ts.map +0 -1
- package/esm/assertron/truthy.d.ts +0 -2
- package/esm/assertron/truthy.d.ts.map +0 -1
- package/esm/index.d.ts.map +0 -1
- package/esm/types.js +0 -2
- package/esm/types.js.map +0 -1
- package/esm/utils/index.d.ts +0 -8
- package/esm/utils/index.d.ts.map +0 -1
- package/esm/utils/isErrorConstructor.d.ts +0 -3
- package/esm/utils/isErrorConstructor.d.ts.map +0 -1
- package/esm/utils/notEqualMessage.d.ts +0 -2
- package/esm/utils/notEqualMessage.d.ts.map +0 -1
- package/esm/utils/notSatisfiedMessage.d.ts +0 -3
- package/esm/utils/notSatisfiedMessage.d.ts.map +0 -1
- package/esm/utils/notThrownMessage.d.ts +0 -2
- package/esm/utils/notThrownMessage.d.ts.map +0 -1
- package/esm/utils/promiseMessages.d.ts +0 -3
- package/esm/utils/promiseMessages.d.ts.map +0 -1
- package/esm/utils/unexpectedErrorMessage.d.ts +0 -3
- package/esm/utils/unexpectedErrorMessage.d.ts.map +0 -1
- package/ts/assert-order/internalInterfaces.ts +0 -5
- package/ts/testUtils.ts +0 -81
package/cjs/assertron/repeat.js
CHANGED
|
@@ -1,37 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.repeat = void 0;
|
|
7
|
-
const is_promise_1 = __importDefault(require("is-promise"));
|
|
8
|
-
const errors_js_1 = require("../errors.js");
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_errors = require("../errors.js");
|
|
3
|
+
let is_promise = require("is-promise");
|
|
4
|
+
is_promise = require_runtime.__toESM(is_promise, 1);
|
|
5
|
+
//#region ts/assertron/repeat.ts
|
|
9
6
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
* Repeat the specified function n times and return the last result.
|
|
8
|
+
* If the result is a promise, it will run the function sequentially.
|
|
9
|
+
*/
|
|
13
10
|
function repeat(fn, times) {
|
|
14
|
-
|
|
11
|
+
return repeatRecur(fn, 1, times);
|
|
15
12
|
}
|
|
16
|
-
exports.repeat = repeat;
|
|
17
13
|
function repeatRecur(fn, i, times) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
if (e instanceof errors_js_1.FailOnOccurrence)
|
|
33
|
-
throw e;
|
|
34
|
-
throw new errors_js_1.FailOnOccurrence(i, e, { ssf: repeat });
|
|
35
|
-
}
|
|
14
|
+
try {
|
|
15
|
+
const result = fn();
|
|
16
|
+
if (i === times) return result;
|
|
17
|
+
if ((0, is_promise.default)(result)) return result.then(() => repeatRecur(fn, i + 1, times), (e) => {
|
|
18
|
+
throw new require_errors.FailOnOccurrence(i, e, { ssf: repeat });
|
|
19
|
+
});
|
|
20
|
+
return repeatRecur(fn, i + 1, times);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
if (e instanceof require_errors.FailOnOccurrence) throw e;
|
|
23
|
+
throw new require_errors.FailOnOccurrence(i, e, { ssf: repeat });
|
|
24
|
+
}
|
|
36
25
|
}
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.repeat = repeat;
|
|
28
|
+
|
|
37
29
|
//# sourceMappingURL=repeat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeat.js","
|
|
1
|
+
{"version":3,"file":"repeat.js","names":["isPromise","FailOnOccurrence"],"sources":["../../ts/assertron/repeat.ts"],"sourcesContent":["import isPromise from 'is-promise'\nimport { FailOnOccurrence } from '../errors.js'\n\n/**\n * Repeat the specified function n times and return the last result.\n * If the result is a promise, it will run the function sequentially.\n */\nexport function repeat<R>(\n\tfn: () => R | (() => Promise<R>),\n\ttimes: number,\n): ReturnType<typeof fn> extends Promise<R> ? Promise<R> : R {\n\treturn repeatRecur(fn, 1, times)\n}\n\nfunction repeatRecur<R>(\n\tfn: () => R | (() => Promise<R>),\n\ti: number,\n\ttimes: number,\n): ReturnType<typeof fn> extends Promise<R> ? Promise<R> : R {\n\ttry {\n\t\tconst result = fn()\n\t\tif (i === times) return result as any\n\n\t\tif (isPromise(result)) {\n\t\t\treturn result.then(\n\t\t\t\t() => repeatRecur(fn, i + 1, times),\n\t\t\t\t(e) => {\n\t\t\t\t\tthrow new FailOnOccurrence(i, e, { ssf: repeat })\n\t\t\t\t},\n\t\t\t) as any\n\t\t}\n\t\treturn repeatRecur(fn, i + 1, times)\n\t} catch (e) {\n\t\tif (e instanceof FailOnOccurrence) throw e\n\t\tthrow new FailOnOccurrence(i, e, { ssf: repeat })\n\t}\n}\n"],"mappings":";;;;;;;;;AAOA,SAAgB,OACf,IACA,OAC4D;CAC5D,OAAO,YAAY,IAAI,GAAG,KAAK;AAChC;AAEA,SAAS,YACR,IACA,GACA,OAC4D;CAC5D,IAAI;EACH,MAAM,SAAS,GAAG;EAClB,IAAI,MAAM,OAAO,OAAO;EAExB,KAAA,GAAIA,WAAAA,QAAAA,CAAU,MAAM,GACnB,OAAO,OAAO,WACP,YAAY,IAAI,IAAI,GAAG,KAAK,IACjC,MAAM;GACN,MAAM,IAAIC,eAAAA,iBAAiB,GAAG,GAAG,EAAE,KAAK,OAAO,CAAC;EACjD,CACD;EAED,OAAO,YAAY,IAAI,IAAI,GAAG,KAAK;CACpC,SAAS,GAAG;EACX,IAAI,aAAaA,eAAAA,kBAAkB,MAAM;EACzC,MAAM,IAAIA,eAAAA,iBAAiB,GAAG,GAAG,EAAE,KAAK,OAAO,CAAC;CACjD;AACD"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const errors_js_1 = require("../errors.js");
|
|
5
|
-
const index_js_1 = require("../utils/index.js");
|
|
1
|
+
const require_promiseMessages = require("../utils/promiseMessages.js");
|
|
2
|
+
const require_errors = require("../errors.js");
|
|
3
|
+
//#region ts/assertron/resolves.ts
|
|
6
4
|
function resolves(promise) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
return promise.then((v) => v, (error) => {
|
|
6
|
+
throw new require_errors.AssertionError(require_promiseMessages.notResolvedMessage(error), { ssf: resolves });
|
|
7
|
+
});
|
|
10
8
|
}
|
|
9
|
+
//#endregion
|
|
11
10
|
exports.resolves = resolves;
|
|
11
|
+
|
|
12
12
|
//# sourceMappingURL=resolves.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolves.js","
|
|
1
|
+
{"version":3,"file":"resolves.js","names":["AssertionError","notResolvedMessage"],"sources":["../../ts/assertron/resolves.ts"],"sourcesContent":["import { AssertionError } from '../errors.js'\nimport { notResolvedMessage } from '../utils/index.js'\n\nexport function resolves(promise: Promise<any>): Promise<void> {\n\treturn promise.then(\n\t\t(v) => v,\n\t\t(error) => {\n\t\t\tthrow new AssertionError(notResolvedMessage(error), { ssf: resolves })\n\t\t},\n\t)\n}\n"],"mappings":";;;AAGA,SAAgB,SAAS,SAAsC;CAC9D,OAAO,QAAQ,MACb,MAAM,IACN,UAAU;EACV,MAAM,IAAIA,eAAAA,eAAeC,wBAAAA,mBAAmB,KAAK,GAAG,EAAE,KAAK,SAAS,CAAC;CACtE,CACD;AACD"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Check if `actual` satisfies criteria in `expected`.
|
|
7
|
-
* @param expected All properties can be a value which will be compared to the same property in `actual`,
|
|
8
|
-
* RegExp, or a predicate function that will be used to check against the property.
|
|
9
|
-
*/
|
|
10
|
-
export declare function satisfies<Actual, Expected extends Actual>(actual: Actual, expected: SatisfyExpectation<Expected>): void;
|
|
1
|
+
import { If, IsExtend, NonComposableTypes } from "type-plus";
|
|
2
|
+
//#region ts/assertron/satisfies.d.ts
|
|
3
|
+
type SatisfyExpectation<T> = If<IsExtend<T, string>, T | RegExp, If<IsExtend<T, NonComposableTypes>, T, If<IsExtend<T, Array<any>>, T extends Array<infer E> ? Array<SatisfyExpectation<E>> : never, { [P in keyof T]?: T[P] extends string ? SatisfyExpectation<T[P]> | RegExp : SatisfyExpectation<T[P]>; }>>> | ((v: T) => boolean);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { SatisfyExpectation };
|
|
11
6
|
//# sourceMappingURL=satisfies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"satisfies.d.ts","
|
|
1
|
+
{"version":3,"file":"satisfies.d.ts","names":[],"sources":["../../ts/assertron/satisfies.ts"],"mappings":";;KAKY,mBAAmB,KAC5B,GACA,SAAS,YACT,IAAI,QACJ,GACC,SAAS,GAAG,qBACZ,GACA,GACC,SAAS,GAAG,aACZ,UAAU,YAAY,KAAK,MAAM,mBAAmB,gBAElD,WAAW,KAAK,EAAE,oBAAoB,mBAAmB,EAAE,MAAM,SAAS,mBAAmB,EAAE,cAKjG,GAAG"}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const errors_js_1 = require("../errors.js");
|
|
6
|
-
const index_js_1 = require("../utils/index.js");
|
|
1
|
+
const require_notSatisfiedMessage = require("../utils/notSatisfiedMessage.js");
|
|
2
|
+
const require_errors = require("../errors.js");
|
|
3
|
+
let satisfier = require("satisfier");
|
|
4
|
+
//#region ts/assertron/satisfies.ts
|
|
7
5
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
* Check if `actual` satisfies criteria in `expected`.
|
|
7
|
+
* @param expected All properties can be a value which will be compared to the same property in `actual`,
|
|
8
|
+
* RegExp, or a predicate function that will be used to check against the property.
|
|
9
|
+
*/
|
|
12
10
|
function satisfies(actual, expected) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
throw new errors_js_1.AssertionError((0, index_js_1.notSatisfiedMessage)(diff), { ssf: satisfies });
|
|
16
|
-
}
|
|
11
|
+
const diff = (0, satisfier.createSatisfier)(expected).exec(actual);
|
|
12
|
+
if (diff) throw new require_errors.AssertionError(require_notSatisfiedMessage.notSatisfiedMessage(diff), { ssf: satisfies });
|
|
17
13
|
}
|
|
14
|
+
//#endregion
|
|
18
15
|
exports.satisfies = satisfies;
|
|
16
|
+
|
|
19
17
|
//# sourceMappingURL=satisfies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"satisfies.js","
|
|
1
|
+
{"version":3,"file":"satisfies.js","names":["createSatisfier","AssertionError","notSatisfiedMessage"],"sources":["../../ts/assertron/satisfies.ts"],"sourcesContent":["import { createSatisfier } from 'satisfier'\nimport type { If, IsExtend, NonComposableTypes } from 'type-plus'\nimport { AssertionError } from '../errors.js'\nimport { notSatisfiedMessage } from '../utils/index.js'\n\nexport type SatisfyExpectation<T> =\n\t| If<\n\t\t\tIsExtend<T, string>,\n\t\t\tT | RegExp,\n\t\t\tIf<\n\t\t\t\tIsExtend<T, NonComposableTypes>,\n\t\t\t\tT,\n\t\t\t\tIf<\n\t\t\t\t\tIsExtend<T, Array<any>>,\n\t\t\t\t\tT extends Array<infer E> ? Array<SatisfyExpectation<E>> : never,\n\t\t\t\t\t{\n\t\t\t\t\t\t[P in keyof T]?: T[P] extends string ? SatisfyExpectation<T[P]> | RegExp : SatisfyExpectation<T[P]>\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t>\n\t >\n\t| ((v: T) => boolean)\n\n/**\n * Check if `actual` satisfies criteria in `expected`.\n * @param expected All properties can be a value which will be compared to the same property in `actual`,\n * RegExp, or a predicate function that will be used to check against the property.\n */\nexport function satisfies<Actual, Expected extends Actual>(\n\tactual: Actual,\n\texpected: SatisfyExpectation<Expected>,\n): void {\n\tconst diff = createSatisfier(expected as any).exec(actual)\n\tif (diff) {\n\t\tthrow new AssertionError(notSatisfiedMessage(diff), { ssf: satisfies })\n\t}\n}\n"],"mappings":";;;;;;;;;AA4BA,SAAgB,UACf,QACA,UACO;CACP,MAAM,QAAA,GAAOA,UAAAA,gBAAAA,CAAgB,QAAe,CAAC,CAAC,KAAK,MAAM;CACzD,IAAI,MACH,MAAM,IAAIC,eAAAA,eAAeC,4BAAAA,oBAAoB,IAAI,GAAG,EAAE,KAAK,UAAU,CAAC;AAExE"}
|
package/cjs/assertron/throws.js
CHANGED
|
@@ -1,62 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_isErrorConstructor = require("../utils/isErrorConstructor.js");
|
|
3
|
+
const require_notThrownMessage = require("../utils/notThrownMessage.js");
|
|
4
|
+
const require_promiseMessages = require("../utils/promiseMessages.js");
|
|
5
|
+
const require_unexpectedErrorMessage = require("../utils/unexpectedErrorMessage.js");
|
|
6
|
+
const require_errors = require("../errors.js");
|
|
7
|
+
let is_promise = require("is-promise");
|
|
8
|
+
is_promise = require_runtime.__toESM(is_promise, 1);
|
|
9
|
+
//#region ts/assertron/throws.ts
|
|
10
10
|
function throws(value, validator) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (failValidation(validator, err)) {
|
|
31
|
-
throw new errors_js_1.AssertionError((0, index_js_1.unexpectedErrorMessage)(err, validator), { ssf: throws, cause: err });
|
|
32
|
-
}
|
|
33
|
-
return err;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
throw new errors_js_1.AssertionError((0, index_js_1.notThrownMessage)(value), { ssf: throws });
|
|
11
|
+
if (typeof value !== "function" && !(0, is_promise.default)(value)) throw new require_errors.AssertionError("`assertron.throws()` must be called with a function or promise.", { ssf: throws });
|
|
12
|
+
if (!(0, is_promise.default)(value)) {
|
|
13
|
+
const { threw, err, result } = tryCatch(value);
|
|
14
|
+
if (threw) {
|
|
15
|
+
if (failValidation(validator, err)) throw new require_errors.AssertionError(require_unexpectedErrorMessage.unexpectedErrorMessage(err, validator), { ssf: throws });
|
|
16
|
+
return err;
|
|
17
|
+
}
|
|
18
|
+
value = result;
|
|
19
|
+
}
|
|
20
|
+
if ((0, is_promise.default)(value)) return value.then((value) => {
|
|
21
|
+
throw new require_errors.AssertionError(require_promiseMessages.notRejectedMessage(value), { ssf: throws });
|
|
22
|
+
}, (err) => {
|
|
23
|
+
if (failValidation(validator, err)) throw new require_errors.AssertionError(require_unexpectedErrorMessage.unexpectedErrorMessage(err, validator), {
|
|
24
|
+
ssf: throws,
|
|
25
|
+
cause: err
|
|
26
|
+
});
|
|
27
|
+
return err;
|
|
28
|
+
});
|
|
29
|
+
throw new require_errors.AssertionError(require_notThrownMessage.notThrownMessage(value), { ssf: throws });
|
|
37
30
|
}
|
|
38
|
-
exports.throws = throws;
|
|
39
31
|
function tryCatch(fn) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
32
|
+
let result;
|
|
33
|
+
let err;
|
|
34
|
+
let threw = false;
|
|
35
|
+
try {
|
|
36
|
+
result = fn();
|
|
37
|
+
} catch (e) {
|
|
38
|
+
err = e;
|
|
39
|
+
threw = true;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
threw,
|
|
43
|
+
err,
|
|
44
|
+
result
|
|
45
|
+
};
|
|
51
46
|
}
|
|
52
47
|
function failValidation(validator, error) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return !(error instanceof validator);
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
return !validator(error);
|
|
60
|
-
}
|
|
48
|
+
if (!validator) return false;
|
|
49
|
+
if (require_isErrorConstructor.isErrorConstructor(validator)) return !(error instanceof validator);
|
|
50
|
+
return !validator(error);
|
|
61
51
|
}
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.throws = throws;
|
|
54
|
+
|
|
62
55
|
//# sourceMappingURL=throws.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throws.js","
|
|
1
|
+
{"version":3,"file":"throws.js","names":["isPromise","AssertionError","unexpectedErrorMessage","notRejectedMessage","notThrownMessage","isErrorConstructor"],"sources":["../../ts/assertron/throws.ts"],"sourcesContent":["import isPromise from 'is-promise'\nimport { AssertionError } from '../errors.js'\nimport type { ErrorConstructor, ErrorValidator } from '../types.js'\nimport { isErrorConstructor, notRejectedMessage, notThrownMessage, unexpectedErrorMessage } from '../utils/index.js'\n\nexport function throws<E extends Error>(\n\tvalue: PromiseLike<any>,\n\terror?: ErrorValidator | ErrorConstructor<E>,\n): Promise<E>\nexport function throws<E extends Error>(\n\tvalue: (...args: any[]) => never,\n\terror?: ErrorValidator | ErrorConstructor<E>,\n): E\nexport function throws<E extends Error, R = any>(\n\tvalue: (...args: any[]) => R,\n\terror?: ErrorValidator | ErrorConstructor<E>,\n): R extends Promise<any> ? Promise<E> : E\nexport function throws<T, R = any>(\n\tvalue: (...args: any[]) => R,\n\tvalidator?: ErrorValidator,\n): R extends Promise<any> ? Promise<T> : T\nexport function throws(\n\tvalue: PromiseLike<any> | (() => any | PromiseLike<any>),\n\tvalidator?: ErrorValidator | ErrorConstructor<any>,\n): any {\n\tif (typeof value !== 'function' && !isPromise(value)) {\n\t\tthrow new AssertionError('`assertron.throws()` must be called with a function or promise.', {\n\t\t\tssf: throws,\n\t\t})\n\t}\n\n\tif (!isPromise(value)) {\n\t\tconst { threw, err, result } = tryCatch(value)\n\t\tif (threw) {\n\t\t\tif (failValidation(validator, err)) {\n\t\t\t\tthrow new AssertionError(unexpectedErrorMessage(err, validator), { ssf: throws })\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tvalue = result\n\t}\n\n\tif (isPromise(value)) {\n\t\treturn value.then(\n\t\t\t(value) => {\n\t\t\t\tthrow new AssertionError(notRejectedMessage(value), { ssf: throws })\n\t\t\t},\n\t\t\t(err) => {\n\t\t\t\tif (failValidation(validator, err)) {\n\t\t\t\t\tthrow new AssertionError(unexpectedErrorMessage(err, validator), { ssf: throws, cause: err })\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t},\n\t\t)\n\t}\n\n\tthrow new AssertionError(notThrownMessage(value), { ssf: throws })\n}\n\nfunction tryCatch(fn: () => any) {\n\tlet result: any\n\tlet err: any\n\tlet threw = false\n\ttry {\n\t\tresult = fn()\n\t} catch (e) {\n\t\terr = e\n\t\tthrew = true\n\t}\n\treturn { threw, err, result }\n}\nfunction failValidation(\n\tvalidator: ErrorValidator | ErrorConstructor<any> | undefined,\n\terror: any,\n): validator is ErrorValidator | ErrorConstructor<any> {\n\tif (!validator) return false\n\n\tif (isErrorConstructor(validator)) {\n\t\treturn !(error instanceof validator)\n\t}\n\treturn !validator(error)\n}\n"],"mappings":";;;;;;;;;AAqBA,SAAgB,OACf,OACA,WACM;CACN,IAAI,OAAO,UAAU,cAAc,EAAA,GAACA,WAAAA,QAAAA,CAAU,KAAK,GAClD,MAAM,IAAIC,eAAAA,eAAe,mEAAmE,EAC3F,KAAK,OACN,CAAC;CAGF,IAAI,EAAA,GAACD,WAAAA,QAAAA,CAAU,KAAK,GAAG;EACtB,MAAM,EAAE,OAAO,KAAK,WAAW,SAAS,KAAK;EAC7C,IAAI,OAAO;GACV,IAAI,eAAe,WAAW,GAAG,GAChC,MAAM,IAAIC,eAAAA,eAAeC,+BAAAA,uBAAuB,KAAK,SAAS,GAAG,EAAE,KAAK,OAAO,CAAC;GAEjF,OAAO;EACR;EACA,QAAQ;CACT;CAEA,KAAA,GAAIF,WAAAA,QAAAA,CAAU,KAAK,GAClB,OAAO,MAAM,MACX,UAAU;EACV,MAAM,IAAIC,eAAAA,eAAeE,wBAAAA,mBAAmB,KAAK,GAAG,EAAE,KAAK,OAAO,CAAC;CACpE,IACC,QAAQ;EACR,IAAI,eAAe,WAAW,GAAG,GAChC,MAAM,IAAIF,eAAAA,eAAeC,+BAAAA,uBAAuB,KAAK,SAAS,GAAG;GAAE,KAAK;GAAQ,OAAO;EAAI,CAAC;EAE7F,OAAO;CACR,CACD;CAGD,MAAM,IAAID,eAAAA,eAAeG,yBAAAA,iBAAiB,KAAK,GAAG,EAAE,KAAK,OAAO,CAAC;AAClE;AAEA,SAAS,SAAS,IAAe;CAChC,IAAI;CACJ,IAAI;CACJ,IAAI,QAAQ;CACZ,IAAI;EACH,SAAS,GAAG;CACb,SAAS,GAAG;EACX,MAAM;EACN,QAAQ;CACT;CACA,OAAO;EAAE;EAAO;EAAK;CAAO;AAC7B;AACA,SAAS,eACR,WACA,OACsD;CACtD,IAAI,CAAC,WAAW,OAAO;CAEvB,IAAIC,2BAAAA,mBAAmB,SAAS,GAC/B,OAAO,EAAE,iBAAiB;CAE3B,OAAO,CAAC,UAAU,KAAK;AACxB"}
|
package/cjs/assertron/truthy.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.truthy = void 0;
|
|
4
|
-
const errors_js_1 = require("../errors.js");
|
|
1
|
+
const require_errors = require("../errors.js");
|
|
2
|
+
//#region ts/assertron/truthy.ts
|
|
5
3
|
function truthy(value, message) {
|
|
6
|
-
|
|
7
|
-
throw new errors_js_1.AssertionError(message !== null && message !== void 0 ? message : `Expected value to be truthy, but received ${value}`, { ssf: truthy });
|
|
4
|
+
if (!value) throw new require_errors.AssertionError(message !== null && message !== void 0 ? message : `Expected value to be truthy, but received ${value}`, { ssf: truthy });
|
|
8
5
|
}
|
|
6
|
+
//#endregion
|
|
9
7
|
exports.truthy = truthy;
|
|
8
|
+
|
|
10
9
|
//# sourceMappingURL=truthy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"truthy.js","
|
|
1
|
+
{"version":3,"file":"truthy.js","names":["AssertionError"],"sources":["../../ts/assertron/truthy.ts"],"sourcesContent":["import { AssertionError } from '../errors.js'\n\nexport function truthy(value: unknown, message?: string | undefined): void {\n\tif (!value) throw new AssertionError(message ?? `Expected value to be truthy, but received ${value}`, { ssf: truthy })\n}\n"],"mappings":";;AAEA,SAAgB,OAAO,OAAgB,SAAoC;CAC1E,IAAI,CAAC,OAAO,MAAM,IAAIA,eAAAA,eAAe,YAAA,QAAA,YAAA,KAAA,IAAA,UAAW,6CAA6C,SAAS,EAAE,KAAK,OAAO,CAAC;AACtH"}
|
package/cjs/errors.d.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { RequiredPick } from "type-plus";
|
|
2
|
+
import { ModuleError } from "iso-error";
|
|
3
|
+
//#region ts/errors.d.ts
|
|
3
4
|
/**
|
|
4
5
|
* A base error for all assertion errors
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
declare class AssertionError extends ModuleError {
|
|
8
|
+
constructor(message: string, options: AssertionError.Options);
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
declare namespace AssertionError {
|
|
11
|
+
type Options = RequiredPick<ModuleError.Options, 'ssf'>;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
declare class FailOnOccurrence extends AssertionError {
|
|
14
|
+
occurrence: number;
|
|
15
|
+
error: any;
|
|
16
|
+
constructor(occurrence: number, error: any, options: AssertionError.Options);
|
|
16
17
|
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { AssertionError, FailOnOccurrence };
|
|
17
20
|
//# sourceMappingURL=errors.d.ts.map
|
package/cjs/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","
|
|
1
|
+
{"version":3,"file":"errors.d.ts","names":[],"sources":["../ts/errors.ts"],"mappings":";;;;;;cAOa,uBAAuB;EACnC,YAAY,iBAAiB,SAAS,eAAe;;kBAKrC;OACJ,UAAU,aAAa,YAAY;;cAGnC,yBAAyB;EAE7B;EACA;EAFR,YACQ,oBACA,YACP,SAAS,eAAe"}
|
package/cjs/errors.js
CHANGED
|
@@ -1,33 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const iso_error_1 = require("iso-error");
|
|
5
|
-
const index_js_1 = require("./utils/index.js");
|
|
1
|
+
const require_index = require("./utils/index.js");
|
|
2
|
+
let iso_error = require("iso-error");
|
|
3
|
+
//#region ts/errors.ts
|
|
6
4
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
5
|
+
* A base error for all assertion errors
|
|
6
|
+
*/
|
|
7
|
+
var AssertionError = class extends iso_error.ModuleError {
|
|
8
|
+
constructor(message, options) {
|
|
9
|
+
super("assertron", message, options);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
var FailOnOccurrence = class extends AssertionError {
|
|
13
|
+
constructor(occurrence, error, options) {
|
|
14
|
+
super(require_index.failOnOccurrence(occurrence, error), options);
|
|
15
|
+
this.occurrence = occurrence;
|
|
16
|
+
this.error = error;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
14
20
|
exports.AssertionError = AssertionError;
|
|
15
|
-
class FailOnOccurrence extends AssertionError {
|
|
16
|
-
constructor(occurrence, error, options) {
|
|
17
|
-
super((0, index_js_1.failOnOccurrence)(occurrence, error), options);
|
|
18
|
-
Object.defineProperty(this, "occurrence", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
configurable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
value: occurrence
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(this, "error", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: error
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
21
|
exports.FailOnOccurrence = FailOnOccurrence;
|
|
22
|
+
|
|
33
23
|
//# sourceMappingURL=errors.js.map
|
package/cjs/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","
|
|
1
|
+
{"version":3,"file":"errors.js","names":["ModuleError","failOnOccurrence"],"sources":["../ts/errors.ts"],"sourcesContent":["import { ModuleError } from 'iso-error'\nimport type { RequiredPick } from 'type-plus'\nimport { failOnOccurrence } from './utils/index.js'\n\n/**\n * A base error for all assertion errors\n */\nexport class AssertionError extends ModuleError {\n\tconstructor(message: string, options: AssertionError.Options) {\n\t\tsuper('assertron', message, options)\n\t}\n}\n\nexport namespace AssertionError {\n\texport type Options = RequiredPick<ModuleError.Options, 'ssf'>\n}\n\nexport class FailOnOccurrence extends AssertionError {\n\tconstructor(\n\t\tpublic occurrence: number,\n\t\tpublic error: any,\n\t\toptions: AssertionError.Options,\n\t) {\n\t\tsuper(failOnOccurrence(occurrence, error), options)\n\t}\n}\n"],"mappings":";;;;;;AAOA,IAAa,iBAAb,cAAoCA,UAAAA,YAAY;CAC/C,YAAY,SAAiB,SAAiC;EAC7D,MAAM,aAAa,SAAS,OAAO;CACpC;AACD;AAMA,IAAa,mBAAb,cAAsC,eAAe;CACpD,YACC,YACA,OACA,SACC;EACD,MAAMC,cAAAA,iBAAiB,YAAY,KAAK,GAAG,OAAO;EAJ3C,KAAA,aAAA;EACA,KAAA,QAAA;CAIR;AACD"}
|
package/cjs/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { SatisfyExpectation } from "./assertron/satisfies.js";
|
|
2
|
+
import { Assertron, assertron } from "./assertron/assertron.js";
|
|
3
|
+
import "./assertron/index.js";
|
|
4
|
+
import { AssertOrder } from "./assert-order/AssertOrder.js";
|
|
5
|
+
import { AssertionError, FailOnOccurrence } from "./errors.js";
|
|
6
|
+
import { State } from "./assert-order/types.js";
|
|
7
|
+
import { InvalidOrder } from "./assert-order/InvalidOrder.js";
|
|
8
|
+
import "./assert-order/index.js";
|
|
9
|
+
import { anything, every, has, hasAll, isInClosedInterval, isInLeftClosedInterval, isInOpenInterval, isInRange, isInRightClosedInterval, isTypeOf, none, some, startsWith } from "satisfier";
|
|
10
|
+
export { AssertOrder, AssertionError, Assertron, FailOnOccurrence, InvalidOrder, type SatisfyExpectation, State, assertron as a, assertron as default, anything, assertron, every, has, hasAll, isInClosedInterval, isInLeftClosedInterval, isInOpenInterval, isInRange, isInRightClosedInterval, isTypeOf, none, some, startsWith };
|
package/cjs/index.js
CHANGED
|
@@ -1,38 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
exports.a =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Object.defineProperty(exports, "
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Object.defineProperty(exports, "
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_errors = require("./errors.js");
|
|
6
|
+
const require_assertron = require("./assertron/assertron.js");
|
|
7
|
+
const require_InvalidOrder = require("./assert-order/InvalidOrder.js");
|
|
8
|
+
const require_AssertOrder = require("./assert-order/AssertOrder.js");
|
|
9
|
+
let satisfier = require("satisfier");
|
|
10
|
+
//#region ts/index.ts
|
|
11
|
+
var ts_default = require_assertron.assertron;
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.AssertOrder = require_AssertOrder.AssertOrder;
|
|
14
|
+
exports.AssertionError = require_errors.AssertionError;
|
|
15
|
+
exports.FailOnOccurrence = require_errors.FailOnOccurrence;
|
|
16
|
+
exports.InvalidOrder = require_InvalidOrder.InvalidOrder;
|
|
17
|
+
exports.a = require_assertron.assertron;
|
|
18
|
+
Object.defineProperty(exports, "anything", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function() {
|
|
21
|
+
return satisfier.anything;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
exports.assertron = require_assertron.assertron;
|
|
25
|
+
exports.default = ts_default;
|
|
26
|
+
Object.defineProperty(exports, "every", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function() {
|
|
29
|
+
return satisfier.every;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "has", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function() {
|
|
35
|
+
return satisfier.has;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "hasAll", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function() {
|
|
41
|
+
return satisfier.hasAll;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "isInClosedInterval", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function() {
|
|
47
|
+
return satisfier.isInClosedInterval;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "isInLeftClosedInterval", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function() {
|
|
53
|
+
return satisfier.isInLeftClosedInterval;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "isInOpenInterval", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function() {
|
|
59
|
+
return satisfier.isInOpenInterval;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, "isInRange", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function() {
|
|
65
|
+
return satisfier.isInRange;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "isInRightClosedInterval", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function() {
|
|
71
|
+
return satisfier.isInRightClosedInterval;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, "isTypeOf", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function() {
|
|
77
|
+
return satisfier.isTypeOf;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "none", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function() {
|
|
83
|
+
return satisfier.none;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(exports, "some", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function() {
|
|
89
|
+
return satisfier.some;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
Object.defineProperty(exports, "startsWith", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function() {
|
|
95
|
+
return satisfier.startsWith;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
38
99
|
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":["assertron"],"sources":["../ts/index.ts"],"sourcesContent":["import { assertron } from './assertron/index.js'\n\nexport {\n\tanything,\n\tevery,\n\thas,\n\thasAll,\n\tisInClosedInterval,\n\tisInLeftClosedInterval,\n\tisInOpenInterval,\n\tisInRange,\n\tisInRightClosedInterval,\n\tisTypeOf,\n\tnone,\n\tsome,\n\tstartsWith,\n} from 'satisfier'\nexport * from './assert-order/index.js'\nexport * from './assertron/index.js'\nexport * from './errors.js'\nexport { assertron as a }\n\nexport default assertron\n"],"mappings":";;;;;;;;;;AAsBA,IAAA,aAAeA,kBAAAA"}
|
package/cjs/package.json
CHANGED
package/cjs/types.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region ts/types.d.ts
|
|
2
|
+
type ErrorValidator = (value: any) => boolean;
|
|
3
|
+
type ErrorConstructor<E extends Error> = new (...args: any[]) => E;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { ErrorConstructor, ErrorValidator };
|
|
3
6
|
//# sourceMappingURL=types.d.ts.map
|