Skip to content

Instantly share code, notes, and snippets.

@younho9
Last active April 26, 2021 23:51
Show Gist options
  • Save younho9/9967ecc9bb6c456b987f69923253cdfd to your computer and use it in GitHub Desktop.
Save younho9/9967ecc9bb6c456b987f69923253cdfd to your computer and use it in GitHub Desktop.
const filterObj = (obj, f) => (o=Object).fromEntries(o.entries(obj).filter([k,v]=>f(k)))
const select = (obj, ...props) => filterObj(obj, k => props.includes(k))
const omit = (obj, ...props) => filterObj(obj, k => !props.includes(k))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment