source: node_modules/@standard-schema/utils/dist/index.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 860 bytes
Line 
1// src/getDotPath/getDotPath.ts
2function getDotPath(issue) {
3 if (issue.path?.length) {
4 let dotPath = "";
5 for (const item of issue.path) {
6 const key = typeof item === "object" ? item.key : item;
7 if (typeof key === "string" || typeof key === "number") {
8 if (dotPath) {
9 dotPath += `.${key}`;
10 } else {
11 dotPath += key;
12 }
13 } else {
14 return null;
15 }
16 }
17 return dotPath;
18 }
19 return null;
20}
21
22// src/SchemaError/SchemaError.ts
23var SchemaError = class extends Error {
24 /**
25 * The schema issues.
26 */
27 issues;
28 /**
29 * Creates a schema error with useful information.
30 *
31 * @param issues The schema issues.
32 */
33 constructor(issues) {
34 super(issues[0].message);
35 this.name = "SchemaError";
36 this.issues = issues;
37 }
38};
39export {
40 SchemaError,
41 getDotPath
42};
Note: See TracBrowser for help on using the repository browser.