Function shake

Removes (shakes out) undefined entries from an object. Optional second argument shakes out values by custom evaluation.

const ra = {
mode: 'god',
greek: false,
limit: undefined
}

shake(ra) // => { mode, greek }
shake(ra, a => !a) // => { mode }
  • Type Parameters

    • RemovedKeys extends string
    • T

    Parameters

    • obj: Readonly<T>
    • filter: ((value: unknown) => boolean) = ...
        • (value): boolean
        • Parameters

          • value: unknown

          Returns boolean

    Returns Omit<T, RemovedKeys>