Skip to content

Commit

Permalink
refactor(cache): remove Object.fromEntries ponyfill (hexojs#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW authored and nevilm-lt committed Apr 22, 2022
1 parent eb7b5e6 commit c4b445e
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,6 @@ module.exports = class Cache {
}

dump() {
// Object#fromEntries supported since Node.js 12

// eslint-disable-next-line node/no-unsupported-features/es-builtins
if (typeof Object.fromEntries === 'function') {
// eslint-disable-next-line node/no-unsupported-features/es-builtins
return Object.fromEntries(this.cache);
}

// FIXME: A polyfill for Node.js 10 & 11
const obj = {};
this.cache.forEach((v, k) => {
obj[k] = v;
});
return obj;
return Object.fromEntries(this.cache);
}
};

0 comments on commit c4b445e

Please sign in to comment.