Skip to content

Instantly share code, notes, and snippets.

@markwylde
Created June 5, 2021 08:54
Show Gist options
  • Save markwylde/2a78b1b3d6eab239bffe37f3ae1f8dbf to your computer and use it in GitHub Desktop.
Save markwylde/2a78b1b3d6eab239bffe37f3ae1f8dbf to your computer and use it in GitHub Desktop.
Actual Stringify
function actualStringify (object) {
const newObject = {};
for (const key in object) {
if (['String', 'Object', 'Number'].includes(object[key].constructor.name)) {
newObject[key] = object[key];
}
}
return JSON.stringify(newObject, null, 2);
}
module.exports = actualStringify;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment