MCPcopy Create free account
hub / github.com/arktypeio/arktype / withoutUndefined

Function withoutUndefined

ark/schema/structure/optional.ts:164–171  ·  view source on GitHub ↗
(value: BaseRoot)

Source from the content-addressed store, hash-verified

162 * value like `unknown` allowing undefined otherwise keeps it, as in TS
163 */
164export const withoutUndefined = (value: BaseRoot): BaseRoot => {
165 const branches = value.branches.filter(branch => !branch.hasUnit(undefined))
166 if (branches.length === value.branches.length) return value
167 return value.$.node("union", {
168 branches,
169 ...(value.is("union") && value.ordered ? { ordered: true } : {})
170 })
171}
172
173export const assertDefaultValueAssignability = (
174 node: BaseRoot,

Callers 3

requiredOfMethod · 0.90
decodedValueOfFunction · 0.90
requiredValueMethod · 0.70

Calls 3

filterMethod · 0.80
nodeMethod · 0.80
isMethod · 0.80

Tested by

no test coverage detected