Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 90x 343x 343x | /**
* This custom tool function removes every pair key/value from an hash. The
* goal is to avoid creating a new object while some other references are
* still hanging in some scopes...
*
* @param {object} obj The object to empty.
* @return {object} The empty object.
*/
export default function emptyObject(obj) {
Object.keys(obj).forEach(k => {
// eslint-disable-next-line no-prototype-builtins
Eif (!("hasOwnProperty" in obj) || obj.hasOwnProperty(k)) {
delete obj[k];
}
});
}
|