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.
Files changed (132) hide show
  1. package/lib/private/ArrayType.d.ts +1 -0
  2. package/lib/private/ArrayType.js +23 -27
  3. package/lib/private/BuiltinType.d.ts +0 -1
  4. package/lib/private/BuiltinType.js +2 -5
  5. package/lib/private/ConstructorType.d.ts +4 -1
  6. package/lib/private/ConstructorType.js +6 -2
  7. package/lib/private/DataType.d.ts +5 -0
  8. package/lib/private/DefaultType.js +3 -6
  9. package/lib/private/EnumType.d.ts +21 -0
  10. package/lib/private/EnumType.js +30 -0
  11. package/lib/private/FunctionType.d.ts +15 -0
  12. package/lib/private/FunctionType.js +20 -0
  13. package/lib/private/IsType.d.ts +19 -0
  14. package/lib/private/IsType.js +29 -0
  15. package/lib/private/Issue.d.ts +2 -0
  16. package/lib/private/IssueType.d.ts +3 -0
  17. package/lib/private/IssueType.js +2 -0
  18. package/lib/private/JSONType.d.ts +27 -0
  19. package/lib/private/JSONType.js +41 -0
  20. package/lib/private/LiteralType.d.ts +4 -0
  21. package/lib/private/LiteralType.js +10 -2
  22. package/lib/private/NormalizeSchema.d.ts +1 -1
  23. package/lib/private/NullType.js +2 -2
  24. package/lib/private/NumberType.d.ts +1 -1
  25. package/lib/private/NumberType.js +1 -1
  26. package/lib/private/ObjectType.d.ts +13 -4
  27. package/lib/private/ObjectType.js +18 -5
  28. package/lib/private/OmitType.js +4 -3
  29. package/lib/private/ParseError.d.ts +5 -1
  30. package/lib/private/ParseError.js +23 -13
  31. package/lib/private/Parsed.d.ts +1 -0
  32. package/lib/private/Parsed.js +3 -0
  33. package/lib/private/PartialType.js +5 -4
  34. package/lib/private/PrimitiveType.d.ts +0 -1
  35. package/lib/private/PrimitiveType.js +6 -14
  36. package/lib/private/RecordType.js +8 -27
  37. package/lib/private/Serialized.d.ts +18 -1
  38. package/lib/private/Storable.d.ts +2 -2
  39. package/lib/private/StoreType.js +2 -2
  40. package/lib/private/StringType.d.ts +0 -1
  41. package/lib/private/StringType.js +5 -11
  42. package/lib/private/TupleType.js +10 -8
  43. package/lib/private/UUIDType.d.ts +17 -0
  44. package/lib/private/UUIDType.js +33 -0
  45. package/lib/private/UUIDV4Type.d.ts +13 -0
  46. package/lib/private/UUIDV4Type.js +23 -0
  47. package/lib/private/UUIDV7Type.d.ts +13 -0
  48. package/lib/private/UUIDV7Type.js +23 -0
  49. package/lib/private/UnionType.js +5 -5
  50. package/lib/private/coerce/bigint.d.ts +1 -1
  51. package/lib/private/coerce/bigint.js +1 -1
  52. package/lib/private/coerce/float.d.ts +2 -0
  53. package/lib/private/coerce/float.js +8 -0
  54. package/lib/private/coerce/int.d.ts +1 -1
  55. package/lib/private/coerce/int.js +6 -3
  56. package/lib/private/enum.d.ts +3 -0
  57. package/lib/private/enum.js +5 -0
  58. package/lib/private/errors.d.ts +21 -0
  59. package/lib/private/errors.js +53 -0
  60. package/lib/private/function.d.ts +7 -0
  61. package/lib/private/function.js +6 -0
  62. package/lib/private/index.d.ts +79 -32
  63. package/lib/private/index.js +14 -0
  64. package/lib/private/is.d.ts +4 -0
  65. package/lib/private/is.js +3 -0
  66. package/lib/private/json/JSONIssue.d.ts +2 -0
  67. package/lib/private/json.d.ts +5 -0
  68. package/lib/private/json.js +5 -0
  69. package/lib/private/object.d.ts +1 -1
  70. package/lib/private/object.js +2 -2
  71. package/lib/private/schema-errors.d.ts +16 -0
  72. package/lib/private/schema-errors.js +17 -0
  73. package/lib/private/spec/bigint.d.ts +1 -1
  74. package/lib/private/spec/bigint.js +30 -41
  75. package/lib/private/spec/biguint.d.ts +1 -1
  76. package/lib/private/spec/biguint.js +29 -45
  77. package/lib/private/spec/int.d.ts +1 -1
  78. package/lib/private/spec/int.js +27 -38
  79. package/lib/private/spec/uint.d.ts +1 -1
  80. package/lib/private/spec/uint.js +31 -43
  81. package/lib/private/test.d.ts +34 -0
  82. package/lib/private/test.js +107 -0
  83. package/lib/private/uuid.d.ts +4 -0
  84. package/lib/private/uuid.js +3 -0
  85. package/lib/private/validator/ends-with.d.ts +1 -2
  86. package/lib/private/validator/ends-with.js +8 -10
  87. package/lib/private/validator/f32.js +3 -8
  88. package/lib/private/validator/integer.d.ts +1 -2
  89. package/lib/private/validator/integer.js +6 -10
  90. package/lib/private/validator/isotime.js +8 -10
  91. package/lib/private/validator/length.js +11 -19
  92. package/lib/private/validator/max.js +14 -15
  93. package/lib/private/validator/min.js +14 -15
  94. package/lib/private/validator/port.d.ts +1 -2
  95. package/lib/private/validator/port.js +6 -9
  96. package/lib/private/validator/range.js +5 -11
  97. package/lib/private/validator/regex.d.ts +1 -1
  98. package/lib/private/validator/regex.js +5 -9
  99. package/lib/private/validator/starts-with.d.ts +1 -2
  100. package/lib/private/validator/starts-with.js +8 -10
  101. package/lib/private/validator/unique-by.d.ts +1 -1
  102. package/lib/private/validator/unique-by.js +8 -14
  103. package/lib/private/validator/unique-with.d.ts +1 -1
  104. package/lib/private/validator/unique-with.js +3 -7
  105. package/lib/private/validator/unique.js +2 -6
  106. package/lib/private/validator/values.js +2 -6
  107. package/lib/public/StoreType.d.ts +1 -1
  108. package/lib/public/index.d.ts +1 -28
  109. package/lib/public/index.js +0 -16
  110. package/package.json +10 -9
  111. package/lib/private/SchemaError.d.ts +0 -4
  112. package/lib/private/SchemaError.js +0 -8
  113. package/lib/private/error/fail.d.ts +0 -3
  114. package/lib/private/error/fail.js +0 -5
  115. package/lib/private/error/schemafail.d.ts +0 -3
  116. package/lib/private/error/schemafail.js +0 -5
  117. package/lib/private/error.d.ts +0 -4
  118. package/lib/private/error.js +0 -11
  119. package/lib/private/expect.d.ts +0 -22
  120. package/lib/private/expect.js +0 -32
  121. package/lib/private/expected.d.ts +0 -3
  122. package/lib/private/expected.js +0 -11
  123. package/lib/private/fail.d.ts +0 -4
  124. package/lib/private/fail.js +0 -6
  125. package/lib/private/test/messages-of.d.ts +0 -3
  126. package/lib/private/test/messages-of.js +0 -4
  127. package/lib/private/test/paths-of.d.ts +0 -3
  128. package/lib/private/test/paths-of.js +0 -4
  129. package/lib/private/test/throws-issues.d.ts +0 -4
  130. package/lib/private/test/throws-issues.js +0 -13
  131. package/lib/private/validator/uuid.d.ts +0 -3
  132. package/lib/private/validator/uuid.js +0 -4
@@ -1,21 +1,15 @@
1
- import ParseError from "#ParseError";
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 (typeof x !== "number" && typeof x !== "bigint") {
10
- throw fail(x, "invalid type");
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 validateRegex(regex: RegExp, error?: ErrorFunction): Validator<string>;
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 ParseError from "#ParseError";
2
- export default function validateRegex(regex, error) {
1
+ import E from "#errors";
2
+ export default function regex(format, error) {
3
3
  return (x) => {
4
- if (!regex.test(x)) {
5
- const message = (error ?? ((y) => `"${y}" is not a valid ${String(regex)}`))(x);
6
- throw new ParseError([{
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,4 +1,3 @@
1
1
  import type Validator from "#Validator";
2
- declare const _default: (prefix: string) => Validator<string>;
3
- export default _default;
2
+ export default function starts_with(prefix: string): Validator<string>;
4
3
  //# sourceMappingURL=starts-with.d.ts.map
@@ -1,11 +1,9 @@
1
- import ParseError from "#ParseError";
2
- export default (prefix) => (x) => {
3
- if (!x.startsWith(prefix)) {
4
- throw new ParseError([{
5
- input: x,
6
- message: `"${x}" does not start with "${prefix}"`,
7
- path: "",
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 uniqueBy<T, K extends PropertyKey>(selector: (item: T) => K): (array: Array<T>) => void;
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 ParseError from "#ParseError";
1
+ import E from "#errors";
2
2
  import join from "#path/join";
3
- function message(k, i, first) {
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 k = selector(array[i]);
11
- if (seen.has(k)) {
12
- const first = seen.get(k);
13
- throw new ParseError([{
14
- input: array,
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(k, i);
13
+ seen.set(key, i);
20
14
  }
21
15
  };
22
16
  }
@@ -1,2 +1,2 @@
1
- export default function uniqueWith<T>(equals: (a: T, b: T) => boolean): (array: Array<T>) => void;
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 ParseError from "#ParseError";
1
+ import E from "#errors";
2
2
  import join from "#path/join";
3
- export default function uniqueWith(equals) {
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 new ParseError([{
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 ParseError from "#ParseError";
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 new ParseError([{
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 ParseError from "#ParseError";
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 new ParseError([{
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
  }
@@ -1,3 +1,3 @@
1
- export { default as Serialized } from "#Serialized";
1
+ export type { default as Serialized } from "#Serialized";
2
2
  export { default } from "#StoreType";
3
3
  //# sourceMappingURL=StoreType.d.ts.map
@@ -1,30 +1,3 @@
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";
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
@@ -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.5.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.6.0",
21
- "@rcompat/cli": "^0.14.0",
22
- "@rcompat/is": "^0.4.2"
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.9.0"
26
+ "@rcompat/type": "^0.11.1"
26
27
  },
27
28
  "imports": {
28
29
  "#*": {
29
- "apekit": "./src/private/*.ts",
30
+ "@primate/source": "./src/private/*.ts",
30
31
  "default": "./lib/private/*.js"
31
32
  }
32
33
  },
33
34
  "exports": {
34
35
  ".": {
35
- "apekit": "./src/public/index.ts",
36
+ "@primate/source": "./src/public/index.ts",
36
37
  "default": "./lib/public/index.js"
37
38
  },
38
39
  "./*": {
39
- "apekit": "./src/public/*.ts",
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": "npm run build && npx proby"
49
+ "test": "npx proby"
49
50
  }
50
51
  }
@@ -1,4 +0,0 @@
1
- export default class SchemaError extends Error {
2
- constructor(message: string, ...params: unknown[]);
3
- }
4
- //# sourceMappingURL=SchemaError.d.ts.map
@@ -1,8 +0,0 @@
1
- import mark from "@rcompat/cli/mark";
2
- export default class SchemaError extends Error {
3
- constructor(message, ...params) {
4
- super(mark(message, ...params));
5
- }
6
- }
7
- ;
8
- //# sourceMappingURL=SchemaError.js.map
@@ -1,3 +0,0 @@
1
- import ParseError from "#ParseError";
2
- export default function fail(input: unknown, msg: string): ParseError;
3
- //# sourceMappingURL=fail.d.ts.map
@@ -1,5 +0,0 @@
1
- import ParseError from "#ParseError";
2
- export default function fail(input, msg) {
3
- return new ParseError([{ input, message: msg, path: "" }]);
4
- }
5
- //# sourceMappingURL=fail.js.map
@@ -1,3 +0,0 @@
1
- import SchemaError from "#SchemaError";
2
- export default function schemafail(message: string, ...args: unknown[]): SchemaError;
3
- //# sourceMappingURL=schemafail.d.ts.map
@@ -1,5 +0,0 @@
1
- import SchemaError from "#SchemaError";
2
- export default function schemafail(message, ...args) {
3
- return new SchemaError(message, ...args);
4
- }
5
- //# sourceMappingURL=schemafail.js.map
@@ -1,4 +0,0 @@
1
- import type ParseIssue from "#ParseIssue";
2
- import type ParseOptions from "#ParseOptions";
3
- export default function error<T>(name: string, x: unknown, options?: ParseOptions<T>): [ParseIssue];
4
- //# sourceMappingURL=error.d.ts.map
@@ -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
@@ -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
@@ -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
@@ -1,3 +0,0 @@
1
- declare const _default: (type: string, x: unknown) => string;
2
- export default _default;
3
- //# sourceMappingURL=expected.d.ts.map
@@ -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
@@ -1,4 +0,0 @@
1
- import error from "#error";
2
- import ParseError from "#ParseError";
3
- export default function fail(...args: Parameters<typeof error>): ParseError;
4
- //# sourceMappingURL=fail.d.ts.map
@@ -1,6 +0,0 @@
1
- import error from "#error";
2
- import ParseError from "#ParseError";
3
- export default function fail(...args) {
4
- return new ParseError(error(...args));
5
- }
6
- //# sourceMappingURL=fail.js.map
@@ -1,3 +0,0 @@
1
- import type ParseIssue from "#ParseIssue";
2
- export default function messagesOf(issues: ParseIssue[]): string[];
3
- //# sourceMappingURL=messages-of.d.ts.map
@@ -1,4 +0,0 @@
1
- export default function messagesOf(issues) {
2
- return issues.map(i => i.message);
3
- }
4
- //# sourceMappingURL=messages-of.js.map
@@ -1,3 +0,0 @@
1
- import type ParseIssue from "#ParseIssue";
2
- export default function pathsOf(issues: ParseIssue[]): import("@rcompat/type").JSONPointer[];
3
- //# sourceMappingURL=paths-of.d.ts.map
@@ -1,4 +0,0 @@
1
- export default function pathsOf(issues) {
2
- return issues.map(i => i.path);
3
- }
4
- //# sourceMappingURL=paths-of.js.map
@@ -1,4 +0,0 @@
1
- import type ParseIssue from "#ParseIssue";
2
- import type Asserter from "@rcompat/test/Asserter";
3
- export default function throwsIssues(assert: Asserter, fn: () => unknown): ParseIssue[];
4
- //# sourceMappingURL=throws-issues.d.ts.map
@@ -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
@@ -1,3 +0,0 @@
1
- declare const _default: import("../Validator.js").default<string>;
2
- export default _default;
3
- //# sourceMappingURL=uuid.d.ts.map
@@ -1,4 +0,0 @@
1
- import regex from "#validator/regex";
2
- const uuid = /^[^\W_]{8}-[^\W_]{4}-[^\W_]{4}-[^\W_]{4}-[^\W_]{12}$/u;
3
- export default regex(uuid, x => `"${x}" is not a valid UUID`);
4
- //# sourceMappingURL=uuid.js.map