pema 0.5.0 → 0.6.1
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/private/ArrayType.d.ts +1 -0
- package/lib/private/ArrayType.js +23 -27
- package/lib/private/BuiltinType.d.ts +0 -1
- package/lib/private/BuiltinType.js +2 -5
- package/lib/private/ConstructorType.d.ts +4 -1
- package/lib/private/ConstructorType.js +6 -2
- package/lib/private/DataType.d.ts +5 -0
- package/lib/private/DefaultType.js +3 -6
- package/lib/private/EnumType.d.ts +21 -0
- package/lib/private/EnumType.js +30 -0
- package/lib/private/FunctionType.d.ts +15 -0
- package/lib/private/FunctionType.js +20 -0
- package/lib/private/IsType.d.ts +19 -0
- package/lib/private/IsType.js +29 -0
- package/lib/private/Issue.d.ts +2 -0
- package/lib/private/IssueType.d.ts +3 -0
- package/lib/private/IssueType.js +2 -0
- package/lib/private/JSONType.d.ts +27 -0
- package/lib/private/JSONType.js +41 -0
- package/lib/private/LiteralType.d.ts +4 -0
- package/lib/private/LiteralType.js +10 -2
- package/lib/private/NormalizeSchema.d.ts +1 -1
- package/lib/private/NullType.js +2 -2
- package/lib/private/NumberType.d.ts +1 -1
- package/lib/private/NumberType.js +1 -1
- package/lib/private/ObjectType.d.ts +13 -4
- package/lib/private/ObjectType.js +18 -5
- package/lib/private/OmitType.js +4 -3
- package/lib/private/ParseError.d.ts +5 -1
- package/lib/private/ParseError.js +23 -13
- package/lib/private/Parsed.d.ts +1 -0
- package/lib/private/Parsed.js +3 -0
- package/lib/private/PartialType.js +5 -4
- package/lib/private/PrimitiveType.d.ts +0 -1
- package/lib/private/PrimitiveType.js +6 -14
- package/lib/private/RecordType.js +8 -27
- package/lib/private/Serialized.d.ts +18 -1
- package/lib/private/Storable.d.ts +2 -2
- package/lib/private/StoreType.js +2 -2
- package/lib/private/StringType.d.ts +0 -1
- package/lib/private/StringType.js +5 -11
- package/lib/private/TupleType.js +10 -8
- package/lib/private/UUIDType.d.ts +17 -0
- package/lib/private/UUIDType.js +33 -0
- package/lib/private/UUIDV4Type.d.ts +13 -0
- package/lib/private/UUIDV4Type.js +23 -0
- package/lib/private/UUIDV7Type.d.ts +13 -0
- package/lib/private/UUIDV7Type.js +23 -0
- package/lib/private/UnionType.js +5 -5
- package/lib/private/coerce/bigint.d.ts +1 -1
- package/lib/private/coerce/bigint.js +1 -1
- package/lib/private/coerce/float.d.ts +2 -0
- package/lib/private/coerce/float.js +8 -0
- package/lib/private/coerce/int.d.ts +1 -1
- package/lib/private/coerce/int.js +6 -3
- package/lib/private/enum.d.ts +3 -0
- package/lib/private/enum.js +5 -0
- package/lib/private/errors.d.ts +21 -0
- package/lib/private/errors.js +53 -0
- package/lib/private/function.d.ts +7 -0
- package/lib/private/function.js +6 -0
- package/lib/private/index.d.ts +79 -32
- package/lib/private/index.js +14 -0
- package/lib/private/is.d.ts +4 -0
- package/lib/private/is.js +3 -0
- package/lib/private/json/JSONIssue.d.ts +2 -0
- package/lib/private/json.d.ts +5 -0
- package/lib/private/json.js +5 -0
- package/lib/private/object.d.ts +1 -1
- package/lib/private/object.js +2 -2
- package/lib/private/schema-errors.d.ts +16 -0
- package/lib/private/schema-errors.js +17 -0
- package/lib/private/spec/bigint.d.ts +1 -1
- package/lib/private/spec/bigint.js +30 -41
- package/lib/private/spec/biguint.d.ts +1 -1
- package/lib/private/spec/biguint.js +29 -45
- package/lib/private/spec/int.d.ts +1 -1
- package/lib/private/spec/int.js +27 -38
- package/lib/private/spec/uint.d.ts +1 -1
- package/lib/private/spec/uint.js +31 -43
- package/lib/private/test.d.ts +34 -0
- package/lib/private/test.js +107 -0
- package/lib/private/uuid.d.ts +4 -0
- package/lib/private/uuid.js +3 -0
- package/lib/private/validator/ends-with.d.ts +1 -2
- package/lib/private/validator/ends-with.js +8 -10
- package/lib/private/validator/f32.js +3 -8
- package/lib/private/validator/integer.d.ts +1 -2
- package/lib/private/validator/integer.js +6 -10
- package/lib/private/validator/isotime.js +8 -10
- package/lib/private/validator/length.js +11 -19
- package/lib/private/validator/max.js +14 -15
- package/lib/private/validator/min.js +14 -15
- package/lib/private/validator/port.d.ts +1 -2
- package/lib/private/validator/port.js +6 -9
- package/lib/private/validator/range.js +5 -11
- package/lib/private/validator/regex.d.ts +1 -1
- package/lib/private/validator/regex.js +5 -9
- package/lib/private/validator/starts-with.d.ts +1 -2
- package/lib/private/validator/starts-with.js +8 -10
- package/lib/private/validator/unique-by.d.ts +1 -1
- package/lib/private/validator/unique-by.js +8 -14
- package/lib/private/validator/unique-with.d.ts +1 -1
- package/lib/private/validator/unique-with.js +3 -7
- package/lib/private/validator/unique.js +2 -6
- package/lib/private/validator/values.js +2 -6
- package/lib/public/StoreType.d.ts +1 -1
- package/lib/public/index.d.ts +1 -28
- package/lib/public/index.js +0 -16
- package/package.json +10 -9
- package/lib/private/SchemaError.d.ts +0 -4
- package/lib/private/SchemaError.js +0 -8
- package/lib/private/error/fail.d.ts +0 -3
- package/lib/private/error/fail.js +0 -5
- package/lib/private/error/schemafail.d.ts +0 -3
- package/lib/private/error/schemafail.js +0 -5
- package/lib/private/error.d.ts +0 -4
- package/lib/private/error.js +0 -11
- package/lib/private/expect.d.ts +0 -22
- package/lib/private/expect.js +0 -32
- package/lib/private/expected.d.ts +0 -3
- package/lib/private/expected.js +0 -11
- package/lib/private/fail.d.ts +0 -4
- package/lib/private/fail.js +0 -6
- package/lib/private/test/messages-of.d.ts +0 -3
- package/lib/private/test/messages-of.js +0 -4
- package/lib/private/test/paths-of.d.ts +0 -3
- package/lib/private/test/paths-of.js +0 -4
- package/lib/private/test/throws-issues.d.ts +0 -4
- package/lib/private/test/throws-issues.js +0 -13
- package/lib/private/validator/uuid.d.ts +0 -3
- package/lib/private/validator/uuid.js +0 -4
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import E from "#errors";
|
|
2
2
|
import is from "@rcompat/is";
|
|
3
|
-
const fail = (input, msg) => new ParseError([{ input, message: msg, path: "" }]);
|
|
4
3
|
export default function range(from, to) {
|
|
5
4
|
if (!is.finite(from) || !is.finite(to)) {
|
|
6
5
|
throw new TypeError("range(): from and to must be finite numbers");
|
|
7
6
|
}
|
|
8
7
|
return (x) => {
|
|
9
|
-
if (
|
|
10
|
-
throw
|
|
11
|
-
}
|
|
12
|
-
if (x < from || x > to) {
|
|
13
|
-
throw new ParseError([{
|
|
14
|
-
input: x,
|
|
15
|
-
message: `${x} is out of range`,
|
|
16
|
-
path: "",
|
|
17
|
-
}]);
|
|
8
|
+
if (!is.number(x) && !is.bigint(x)) {
|
|
9
|
+
throw E.invalid_type(x, "number or bigint");
|
|
18
10
|
}
|
|
11
|
+
if (x < from || x > to)
|
|
12
|
+
throw E.out_of_range(x, `${x} is out of range`);
|
|
19
13
|
};
|
|
20
14
|
}
|
|
21
15
|
;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Validator from "#Validator";
|
|
2
2
|
type ErrorFunction = (x: string) => string;
|
|
3
|
-
export default function
|
|
3
|
+
export default function regex(format: RegExp, error?: ErrorFunction): Validator<string>;
|
|
4
4
|
export {};
|
|
5
5
|
//# sourceMappingURL=regex.d.ts.map
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default function
|
|
1
|
+
import E from "#errors";
|
|
2
|
+
export default function regex(format, error) {
|
|
3
3
|
return (x) => {
|
|
4
|
-
if (!
|
|
5
|
-
const message = (error ?? ((y) => `"${y}" is not a valid ${String(
|
|
6
|
-
throw
|
|
7
|
-
input: x,
|
|
8
|
-
message,
|
|
9
|
-
path: "", // root; the calling type should rebase if needed
|
|
10
|
-
}]);
|
|
4
|
+
if (!format.test(x)) {
|
|
5
|
+
const message = (error ?? ((y) => `"${y}" is not a valid ${String(format)}`))(x);
|
|
6
|
+
throw E.invalid_format(x, message);
|
|
11
7
|
}
|
|
12
8
|
};
|
|
13
9
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default (prefix)
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
};
|
|
1
|
+
import E from "#errors";
|
|
2
|
+
export default function starts_with(prefix) {
|
|
3
|
+
return (x) => {
|
|
4
|
+
if (!x.startsWith(prefix)) {
|
|
5
|
+
throw E.invalid_format(x, `"${x}" does not start with "${prefix}"`);
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
}
|
|
11
9
|
//# sourceMappingURL=starts-with.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function
|
|
1
|
+
export default function unique_by<T, K>(select: (value: T) => K): (array: T[]) => void;
|
|
2
2
|
//# sourceMappingURL=unique-by.d.ts.map
|
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import E from "#errors";
|
|
2
2
|
import join from "#path/join";
|
|
3
|
-
function
|
|
4
|
-
return `duplicate key "${String(k)}" at index ${i} (first ${first})`;
|
|
5
|
-
}
|
|
6
|
-
export default function uniqueBy(selector) {
|
|
3
|
+
export default function unique_by(select) {
|
|
7
4
|
return (array) => {
|
|
8
5
|
const seen = new Map();
|
|
9
6
|
for (let i = 0; i < array.length; i++) {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
message: message(k, i, first),
|
|
16
|
-
path: join("", i),
|
|
17
|
-
}]);
|
|
7
|
+
const value = array[i];
|
|
8
|
+
const key = select(value);
|
|
9
|
+
if (seen.has(key)) {
|
|
10
|
+
const first = seen.get(key);
|
|
11
|
+
throw E.duplicate(array, `duplicate value at index ${i} (first seen at ${first})`, join("", i));
|
|
18
12
|
}
|
|
19
|
-
seen.set(
|
|
13
|
+
seen.set(key, i);
|
|
20
14
|
}
|
|
21
15
|
};
|
|
22
16
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export default function
|
|
1
|
+
export default function unique<T>(equals: (a: T, b: T) => boolean): (array: Array<T>) => void;
|
|
2
2
|
//# sourceMappingURL=unique-with.d.ts.map
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import E from "#errors";
|
|
2
2
|
import join from "#path/join";
|
|
3
|
-
export default function
|
|
3
|
+
export default function unique(equals) {
|
|
4
4
|
return (array) => {
|
|
5
5
|
for (let i = 0; i < array.length; i++) {
|
|
6
6
|
for (let j = 0; j < i; j++) {
|
|
7
7
|
if (equals(array[i], array[j])) {
|
|
8
|
-
throw
|
|
9
|
-
input: array,
|
|
10
|
-
message: `items at ${j} and ${i} considered equal`,
|
|
11
|
-
path: join("", i),
|
|
12
|
-
}]);
|
|
8
|
+
throw E.duplicate(array, `items at ${j} and ${i} considered equal`, join("", i));
|
|
13
9
|
}
|
|
14
10
|
}
|
|
15
11
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import E from "#errors";
|
|
2
2
|
import join from "#path/join";
|
|
3
3
|
export default function unique(array) {
|
|
4
4
|
const seen = new Map();
|
|
@@ -7,11 +7,7 @@ export default function unique(array) {
|
|
|
7
7
|
if (seen.has(v)) {
|
|
8
8
|
const first = seen.get(v);
|
|
9
9
|
// key = current duplicate index
|
|
10
|
-
throw
|
|
11
|
-
input: array,
|
|
12
|
-
message: `duplicate value at index ${i} (first seen at ${first})`,
|
|
13
|
-
path: join("", i),
|
|
14
|
-
}]);
|
|
10
|
+
throw E.duplicate(array, `duplicate value at index ${i} (first seen at ${first})`, join("", i));
|
|
15
11
|
}
|
|
16
12
|
seen.set(v, i);
|
|
17
13
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import E from "#errors";
|
|
2
2
|
export default function values(input) {
|
|
3
3
|
const input_values = Object.values(input);
|
|
4
4
|
const allowed = input_values.map(v => String(v)).join(", ");
|
|
5
5
|
return (x) => {
|
|
6
6
|
if (!input_values.includes(x)) {
|
|
7
|
-
throw
|
|
8
|
-
input: x,
|
|
9
|
-
message: `"${x}" not in given list of values (${allowed})`,
|
|
10
|
-
path: "",
|
|
11
|
-
}]);
|
|
7
|
+
throw E.not_in_set(x, `"${x}" not in given list of values (${allowed})`);
|
|
12
8
|
}
|
|
13
9
|
};
|
|
14
10
|
}
|
package/lib/public/index.d.ts
CHANGED
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { default as BooleanType } from "#BooleanType";
|
|
3
|
-
export { default as ConstructorType } from "#ConstructorType";
|
|
4
|
-
export { default as DefaultType } from "#DefaultType";
|
|
1
|
+
export type * from "#index";
|
|
5
2
|
export { default } from "#index";
|
|
6
|
-
export { default as LiteralType } from "#LiteralType";
|
|
7
|
-
export { default as NumberType } from "#NumberType";
|
|
8
|
-
export { default as ObjectType } from "#ObjectType";
|
|
9
|
-
export { default as OptionalType } from "#OptionalType";
|
|
10
|
-
export { default as PureType } from "#PureType";
|
|
11
|
-
export { default as RecordType } from "#RecordType";
|
|
12
|
-
export { default as StringType } from "#StringType";
|
|
13
|
-
export { default as TupleType } from "#TupleType";
|
|
14
|
-
export { default as UintType } from "#UintType";
|
|
15
|
-
export { default as UndefinedType } from "#UndefinedType";
|
|
16
|
-
export { default as UnionType } from "#UnionType";
|
|
17
|
-
export { default as UnknownType } from "#UnknownType";
|
|
18
|
-
export type { default as DataKey } from "#DataKey";
|
|
19
|
-
export type { default as DataType } from "#DataType";
|
|
20
|
-
export type { default as Id } from "#Id";
|
|
21
|
-
export type { default as InferStore } from "#InferStore";
|
|
22
|
-
export type { default as InferStoreOut } from "#InferStoreOut";
|
|
23
|
-
export type { default as Issue } from "#Issue";
|
|
24
|
-
export type { default as JSONPayload } from "#json/JSONPayload";
|
|
25
|
-
export type { default as Schema } from "#Schema";
|
|
26
|
-
export type { default as Serialized } from "#Serialized";
|
|
27
|
-
export type { default as Storable } from "#Storable";
|
|
28
|
-
export type { default as StoreId } from "#StoreId";
|
|
29
|
-
export type { default as StoreSchema } from "#StoreSchema";
|
|
30
3
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/public/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
export { default as ArrayType } from "#ArrayType";
|
|
2
|
-
export { default as BooleanType } from "#BooleanType";
|
|
3
|
-
export { default as ConstructorType } from "#ConstructorType";
|
|
4
|
-
export { default as DefaultType } from "#DefaultType";
|
|
5
1
|
export { default } from "#index";
|
|
6
|
-
export { default as LiteralType } from "#LiteralType";
|
|
7
|
-
export { default as NumberType } from "#NumberType";
|
|
8
|
-
export { default as ObjectType } from "#ObjectType";
|
|
9
|
-
export { default as OptionalType } from "#OptionalType";
|
|
10
|
-
export { default as PureType } from "#PureType";
|
|
11
|
-
export { default as RecordType } from "#RecordType";
|
|
12
|
-
export { default as StringType } from "#StringType";
|
|
13
|
-
export { default as TupleType } from "#TupleType";
|
|
14
|
-
export { default as UintType } from "#UintType";
|
|
15
|
-
export { default as UndefinedType } from "#UndefinedType";
|
|
16
|
-
export { default as UnionType } from "#UnionType";
|
|
17
|
-
export { default as UnknownType } from "#UnknownType";
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Primate schema validation",
|
|
5
5
|
"homepage": "https://primate.run/docs/validation",
|
|
6
6
|
"bugs": "https://github.com/primate-run/primate/issues",
|
|
@@ -17,26 +17,27 @@
|
|
|
17
17
|
"!/**/*.spec.*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@rcompat/assert": "^0.
|
|
21
|
-
"@rcompat/cli": "^0.
|
|
22
|
-
"@rcompat/
|
|
20
|
+
"@rcompat/assert": "^0.8.1",
|
|
21
|
+
"@rcompat/cli": "^0.18.1",
|
|
22
|
+
"@rcompat/error": "^0.3.1",
|
|
23
|
+
"@rcompat/is": "^0.6.1"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
|
-
"@rcompat/type": "^0.
|
|
26
|
+
"@rcompat/type": "^0.11.1"
|
|
26
27
|
},
|
|
27
28
|
"imports": {
|
|
28
29
|
"#*": {
|
|
29
|
-
"
|
|
30
|
+
"@primate/source": "./src/private/*.ts",
|
|
30
31
|
"default": "./lib/private/*.js"
|
|
31
32
|
}
|
|
32
33
|
},
|
|
33
34
|
"exports": {
|
|
34
35
|
".": {
|
|
35
|
-
"
|
|
36
|
+
"@primate/source": "./src/public/index.ts",
|
|
36
37
|
"default": "./lib/public/index.js"
|
|
37
38
|
},
|
|
38
39
|
"./*": {
|
|
39
|
-
"
|
|
40
|
+
"@primate/source": "./src/public/*.ts",
|
|
40
41
|
"default": "./lib/public/*.js"
|
|
41
42
|
}
|
|
42
43
|
},
|
|
@@ -45,6 +46,6 @@
|
|
|
45
46
|
"clean": "rm -rf ./lib",
|
|
46
47
|
"lint": "eslint .",
|
|
47
48
|
"lint:fix": "eslint . --fix",
|
|
48
|
-
"test": "
|
|
49
|
+
"test": "npx proby"
|
|
49
50
|
}
|
|
50
51
|
}
|
package/lib/private/error.d.ts
DELETED
package/lib/private/error.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import expected from "#expected";
|
|
2
|
-
import ParsedKey from "#ParsedKey";
|
|
3
|
-
export default function error(name, x, options) {
|
|
4
|
-
return [{
|
|
5
|
-
input: x,
|
|
6
|
-
message: expected(name, x),
|
|
7
|
-
path: options?.[ParsedKey] ?? "",
|
|
8
|
-
}];
|
|
9
|
-
}
|
|
10
|
-
;
|
|
11
|
-
//# sourceMappingURL=error.js.map
|
package/lib/private/expect.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
declare const types: {
|
|
2
|
-
a: string;
|
|
3
|
-
b: string;
|
|
4
|
-
bb: string;
|
|
5
|
-
bi: string;
|
|
6
|
-
co: string;
|
|
7
|
-
d: string;
|
|
8
|
-
f: string;
|
|
9
|
-
i: string;
|
|
10
|
-
n: string;
|
|
11
|
-
nl: string;
|
|
12
|
-
o: string;
|
|
13
|
-
s: string;
|
|
14
|
-
sy: string;
|
|
15
|
-
u: string;
|
|
16
|
-
ui: string;
|
|
17
|
-
ur: string;
|
|
18
|
-
};
|
|
19
|
-
type At = number | string;
|
|
20
|
-
export default function expect(type: keyof typeof types, got: unknown, at?: At): string;
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=expect.d.ts.map
|
package/lib/private/expect.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const types = {
|
|
2
|
-
a: "array",
|
|
3
|
-
b: "boolean",
|
|
4
|
-
bb: "blob",
|
|
5
|
-
bi: "bigint",
|
|
6
|
-
co: "constructor",
|
|
7
|
-
d: "date",
|
|
8
|
-
f: "file",
|
|
9
|
-
i: "int",
|
|
10
|
-
n: "number",
|
|
11
|
-
nl: "null",
|
|
12
|
-
o: "object",
|
|
13
|
-
s: "string",
|
|
14
|
-
sy: "symbol",
|
|
15
|
-
u: "undefined",
|
|
16
|
-
ui: "uint",
|
|
17
|
-
ur: "url",
|
|
18
|
-
};
|
|
19
|
-
const prefix = (at) => at ? `.${at}: ` : "";
|
|
20
|
-
function print_got(got) {
|
|
21
|
-
if (got === undefined) {
|
|
22
|
-
return "undefined";
|
|
23
|
-
}
|
|
24
|
-
if (got === null) {
|
|
25
|
-
return "null";
|
|
26
|
-
}
|
|
27
|
-
return `\`${got}\` (${typeof got})`;
|
|
28
|
-
}
|
|
29
|
-
export default function expect(type, got, at = "") {
|
|
30
|
-
return `${prefix(`${at}`)}expected ${types[type]}, got ${print_got(got)}`;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=expect.js.map
|
package/lib/private/expected.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function print_got(x) {
|
|
2
|
-
if (x === undefined) {
|
|
3
|
-
return "undefined";
|
|
4
|
-
}
|
|
5
|
-
if (x === null) {
|
|
6
|
-
return "null";
|
|
7
|
-
}
|
|
8
|
-
return `\`${x?.toString() ?? x}\` (${(typeof x)})`;
|
|
9
|
-
}
|
|
10
|
-
export default (type, x) => `expected ${type}, got ${print_got(x)}`;
|
|
11
|
-
//# sourceMappingURL=expected.js.map
|
package/lib/private/fail.d.ts
DELETED
package/lib/private/fail.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default function throwsIssues(assert, fn) {
|
|
2
|
-
try {
|
|
3
|
-
fn();
|
|
4
|
-
// fail if nothing was thrown
|
|
5
|
-
assert().fail();
|
|
6
|
-
return []; // unreachable
|
|
7
|
-
}
|
|
8
|
-
catch (error) {
|
|
9
|
-
const e = error;
|
|
10
|
-
return e.issues ?? [];
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=throws-issues.js.map
|