mobily / ts-belt

🔧 Fast, modern, and practical utility library for FP in TypeScript.
https://mobily.github.io/ts-belt
MIT License
1.08k stars 30 forks source link

Would a D.deleteOtherKeys be useful as part of the core? #83

Closed devotox closed 1 year ago

devotox commented 1 year ago

I find myself doing something like this quite often

export const sanitizeProps = (props, allowedProps) =>
    Object.keys(props)
        .filter(propName => !allowedProps.includes(propName))
        .reduce((acc, key) => ({ ...acc, [key]: props[key] }), {});
devotox commented 1 year ago

D.selectKeys works