aws-sdk-js-codemod
Version:
Collection of codemod scripts that help update AWS SDK for JavaScript APIs
23 lines (22 loc) • 813 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getValueIndentedWithTabs = void 0;
const node_os_1 = require("node:os");
const INDENTATION_REGEX = /^(\t*)( {4})/;
const getValueIndentedWithTabs = (value) => {
const lines = [];
for (const line of value.split(node_os_1.EOL)) {
const match = line.match(INDENTATION_REGEX);
if (match) {
const numberOfTabs = match[1].length;
const numberOfSpaces = match[2].length;
const numberOfIndents = numberOfTabs + numberOfSpaces / 4;
lines.push("\t".repeat(numberOfIndents) + line.trimLeft());
}
else {
lines.push(line);
}
}
return lines.join(node_os_1.EOL);
};
exports.getValueIndentedWithTabs = getValueIndentedWithTabs;