@clickup/pg-mig
Version:
PostgreSQL schema migration tool with microsharding and clustering support
18 lines • 667 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.dedent = dedent;
/**
* Removes leading indentation from each line of the text. Also, it some line
* contains only the indentation spaces immediately followed by \n, the line is
* removed entirely.
*/
function dedent(text) {
text = text.replace(/^([ \t\r]*\n)+/s, "").trimEnd();
const spacePrefix = text.match(/^([ \t]+)/s) ? RegExp.$1 : null;
return ((spacePrefix
? text
.replace(new RegExp(`^${spacePrefix}\n`, "mg"), "")
.replace(new RegExp(`^${spacePrefix}`, "mg"), "")
: text) + "\n");
}
//# sourceMappingURL=dedent.js.map