Skip to content

Commit

Permalink
Early return from addStringify
Browse files Browse the repository at this point in the history
  • Loading branch information
aravindet committed Jan 24, 2024
1 parent 21b9e0c commit 9f339bf
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/common/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,19 @@ const stringifyDescriptor = {
};

export function addStringify(buffer) {
if (
'toJSON' in buffer ||
Symbol.for('nodejs.util.inspect.custom') in buffer
) {
return buffer;
}
Object.defineProperties(buffer, {
toJSON: stringifyDescriptor,
toString: stringifyDescriptor,
[Symbol.for('nodejs.util.inspect.custom')]: stringifyDescriptor,
});
return buffer;
// if (
// 'toJSON' in buffer ||
// Symbol.for('nodejs.util.inspect.custom') in buffer
// ) {
// return buffer;
// }
// Object.defineProperties(buffer, {
// toJSON: stringifyDescriptor,
// toString: stringifyDescriptor,
// [Symbol.for('nodejs.util.inspect.custom')]: stringifyDescriptor,
// });
// return buffer;
}

addStringify(MIN_KEY);
Expand Down

0 comments on commit 9f339bf

Please sign in to comment.