servitect
Version:
servitect stands for Server-Architect. A one-click Node.js MVC Server generator
10 lines (9 loc) • 377 B
JavaScript
// Utility Function to remove unnecessary indentation and tab spaces
const removeIndentation = (str) => {
const lines = str.split("\n");
const minIndent = Math.min(
...lines.filter(line => line.trim()).map(line => line.match(/^(\s*)/)[1].length)
);
return lines.map(line => line.slice(minIndent)).join("\n").trim();
};
export default removeIndentation;