var omit1 = (originalObj = {}, keysToOmit = []) =>
Object.fromEntries(
Object.entries(originalObj)
.filter(([key]) => !keysToOmit.includes(key))
)
var omit2 = new Function('obj', 'if (!obj) return {}; const { a, d, i, ...res } = obj; return res;');
var omit3 = (originalObject = {}, keysToOmit = []) => {
const clonedObject = { ...originalObject };
for (const path of keysToOmit) {
delete clonedObject[path]
}
return clonedObject;
}
function omit4(obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
}
function omitProd(src) {
if (!src || typeof src !== 'object') return {};
const clonedObject = { ...src };
let idx = 0;
let propsList = arguments;
if (Array.isArray(propsList[1])) {
propsList = propsList[1];
idx = -1;
}
const len = propsList.length;
while (++idx < len) {
const key = propsList[idx];
delete clonedObject[key];
}
return clonedObject;
}
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min) + min);
}
var data = [];
for (let i = 0; i < 10000; i++) {
const obj = {};
const propsCount = getRandomInt(0, 10);
for (let j = 0; j < propsCount; j++) {
const propCode = getRandomInt(97, 122);
obj[String.fromCharCode(propCode)] = propCode;
}
data.push(obj);
}