1 |
- {"ast":null,"code":"import { parseDef } from \"../parseDef.js\";\nexport function parseTupleDef(def, refs) {\n if (def.rest) {\n return {\n type: \"array\",\n minItems: def.items.length,\n items: def.items.map((x, i) => parseDef(x._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", `${i}`]\n })).reduce((acc, x) => x === undefined ? acc : [...acc, x], []),\n additionalItems: parseDef(def.rest._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"additionalItems\"]\n })\n };\n } else {\n return {\n type: \"array\",\n minItems: def.items.length,\n maxItems: def.items.length,\n items: def.items.map((x, i) => parseDef(x._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", `${i}`]\n })).reduce((acc, x) => x === undefined ? acc : [...acc, x], [])\n };\n }\n}","map":{"version":3,"names":["parseDef","parseTupleDef","def","refs","rest","type","minItems","items","length","map","x","i","_def","currentPath","reduce","acc","undefined","additionalItems","maxItems"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js"],"sourcesContent":["import { parseDef } from \"../parseDef.js\";\nexport function parseTupleDef(def, refs) {\n if (def.rest) {\n return {\n type: \"array\",\n minItems: def.items.length,\n items: def.items\n .map((x, i) => parseDef(x._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", `${i}`],\n }))\n .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []),\n additionalItems: parseDef(def.rest._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"additionalItems\"],\n }),\n };\n }\n else {\n return {\n type: \"array\",\n minItems: def.items.length,\n maxItems: def.items.length,\n items: def.items\n .map((x, i) => parseDef(x._def, {\n ...refs,\n currentPath: [...refs.currentPath, \"items\", `${i}`],\n }))\n .reduce((acc, x) => (x === undefined ? acc : [...acc, x]), []),\n };\n }\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,OAAO,SAASC,aAAaA,CAACC,GAAG,EAAEC,IAAI,EAAE;EACrC,IAAID,GAAG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