MCPcopy Index your code
hub / github.com/tinyplex/tinybase / getProperties

Function getProperties

src/schematizers/schematizer-arktype/index.ts:80–101  ·  view source on GitHub ↗
(schema: any)

Source from the content-addressed store, hash-verified

78};
79
80const getProperties = (schema: any) => {
81 const properties: {[key: string]: any} = objNew();
82 const schemaData = schema?.json ?? schema;
83
84 if (schemaData?.[REQUIRED]) {
85 arrayForEach(schemaData[REQUIRED], (field: any) => {
86 properties[field[KEY]] = field[_VALUE];
87 });
88 }
89
90 if (schemaData?.[OPTIONAL]) {
91 arrayForEach(schemaData[OPTIONAL], (field: any) => {
92 const value = field[_VALUE];
93 const defaultVal = field[DEFAULT];
94 properties[field[KEY]] = !isUndefined(defaultVal)
95 ? {[_VALUE]: value, [DEFAULT]: defaultVal}
96 : value;
97 });
98 }
99
100 return objIsEmpty(properties) ? undefined : properties;
101};
102
103const unwrapSchemaWithDefaults = (
104 schema: any,

Callers

nothing calls this directly

Calls 4

objNewFunction · 0.90
arrayForEachFunction · 0.90
isUndefinedFunction · 0.90
objIsEmptyFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…