1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const utils_1 = require("./utils");
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function getForcedLeadingFn(rule) {
|
10 | if (!rule || !(0, utils_1.ruleIsActive)(rule)) {
|
11 | return (input) => input;
|
12 | }
|
13 | const remove = (input) => {
|
14 | const fragments = input.split('\n');
|
15 | return fragments[0] === '' ? fragments.slice(1).join('\n') : input;
|
16 | };
|
17 | const lead = (input) => {
|
18 | const fragments = input.split('\n');
|
19 | return fragments[0] === '' ? input : ['', ...fragments].join('\n');
|
20 | };
|
21 | return !(0, utils_1.ruleIsNotApplicable)(rule) ? lead : remove;
|
22 | }
|
23 | exports.default = getForcedLeadingFn;
|
24 |
|
\ | No newline at end of file |