Created
April 24, 2020 04:52
-
-
Save privatenumber/70f1777833e57da5184cf371cc53552b to your computer and use it in GitHub Desktop.
Increase console.group indentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const kGroupIndent = Object.getOwnPropertySymbols(console).find(s => s.description === 'kGroupIndent'); | |
function increaseConsoleGroupIndent(increaseIndentBy = ' ') { | |
const { group, groupEnd } = console; | |
console.group = function () { | |
group.apply(this, arguments); | |
this[kGroupIndent] += increaseIndentBy; | |
}; | |
console.groupEnd = function () { | |
groupEnd.apply(this, arguments); | |
this[kGroupIndent] = this[kGroupIndent].slice(0, this[kGroupIndent].length - increaseIndentBy.length); | |
}; | |
} | |
module.exports = increaseConsoleGroupIndent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment