UNPKG

@sinclair/typebox

Version:

Json Schema Type Builder with Static Type Resolution for TypeScript

9 lines (8 loc) 293 B
function DiscardKey(value, key) { const { [key]: _, ...rest } = value; return rest; } /** Discards property keys from the given value. This function returns a shallow Clone. */ export function Discard(value, keys) { return keys.reduce((acc, key) => DiscardKey(acc, key), value); }