UNPKG

eslint-plugin-sql

Version:
16 lines (15 loc) 604 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.dropBaseIndent = void 0; // based on https://github.com/sindresorhus/strip-indent const dropBaseIndent = (raw) => { const trimmedString = raw.replace(/ *$/u, ''); const matches = trimmedString.match(/^[\t ]*(?=\S)/gmu); if (!matches) return trimmedString; const indent = Math.min(...matches.map((match) => match.length)); if (!indent) return trimmedString; return trimmedString.replaceAll(new RegExp(`^[ \\t]{${indent}}`, 'gmu'), ''); }; exports.dropBaseIndent = dropBaseIndent;