Skip to content

Instantly share code, notes, and snippets.

@theer1k
Created September 22, 2022 12:18
Show Gist options
  • Save theer1k/ec16a6b09481495114c1a5b3dfbab328 to your computer and use it in GitHub Desktop.
Save theer1k/ec16a6b09481495114c1a5b3dfbab328 to your computer and use it in GitHub Desktop.
Omit object properties
/**
* Create an object composed without ommited object properties
* @param {Object} object
* @param {string} keys
* @returns {Object}
*/
const omit = (obj, ...keys) => Object.fromEntries(
Object.entries(obj)
.filter(([key]) => !keys.includes(key))
);
module.exports = omit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment