Repository URL to install this package:
|
Version:
1.1.6 ▾
|
/**
* @see https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-377567046
*/
import { isObjPure } from 'exotic';
/**
* Returns a new object with the key/value pairs from `obj`
* that are not in the array `omitKeys`.
*/
export const omit = (obj, omitKeys) => {
const result = {};
// @todo should work on sets?
const keys = isObjPure(omitKeys) ? Object.keys(omitKeys) : omitKeys;
Object.keys(obj).forEach(key => {
if (keys.includes(key) === false) {
result[key] = obj[key];
}
});
return result;
};
//# sourceMappingURL=omit.js.map