de-indent
remove extra indent from a block of code
de-indent
This is a small utility that cleans up indentation in blocks of code. If you copy code from somewhere and it has extra spaces or tabs at the beginning of every line, this tool strips away that unnecessary padding and leaves just the meaningful indentation.
Think of it like this: if you're building a code editor, documentation generator, or any tool that works with code snippets, you often end up with text that's been indented as part of a larger document or template. For example, if you embed a code sample inside a JavaScript template string that's itself indented, every line of that code gets those extra spaces. This library removes that uniform extra indentation, making the code look clean again without touching the relative indentation that actually matters for readability.
The README doesn't provide detailed usage examples, but the core job is straightforward—pass in a string of code, and it returns the same code with leading whitespace normalized. It's the kind of helper function you might write once and forget about, except someone packaged it up so you don't have to.
This would be useful for developers building tools like code formatters, documentation sites, or IDE extensions. Anyone processing code text programmatically might find themselves needing this at some point. It's lightweight and focused on doing one thing well, which makes it easy to drop into a larger project.