extra-utils
Advanced tools
Comparing version 3.6.0 to 3.7.0
@@ -1,1 +0,1 @@ | ||
export declare function removeLeadingBlankLines(text: string): string; | ||
export declare function removeLeadingBlankLines(text: string, maxRemovals?: number): string; |
@@ -5,6 +5,10 @@ "use strict"; | ||
const utils_1 = require("./utils"); | ||
function removeLeadingBlankLines(text) { | ||
function removeLeadingBlankLines(text, maxRemovals = Infinity) { | ||
const lines = text.split('\n'); | ||
while (lines.length > 0 && (0, utils_1.isBlankLine)(lines[0])) { | ||
let removals = 0; | ||
while (removals < maxRemovals && | ||
lines.length > 0 && | ||
(0, utils_1.isBlankLine)(lines[0])) { | ||
lines.shift(); | ||
removals++; | ||
} | ||
@@ -11,0 +15,0 @@ return lines.join('\n'); |
@@ -1,1 +0,1 @@ | ||
export declare function removeTrailingBlankLines(text: string): string; | ||
export declare function removeTrailingBlankLines(text: string, maxRemovals?: number): string; |
@@ -5,6 +5,10 @@ "use strict"; | ||
const utils_1 = require("./utils"); | ||
function removeTrailingBlankLines(text) { | ||
function removeTrailingBlankLines(text, maxRemovals = Infinity) { | ||
const lines = text.split('\n'); | ||
while (lines.length > 0 && (0, utils_1.isBlankLine)(lines[lines.length - 1])) { | ||
let removals = 0; | ||
while (removals < maxRemovals && | ||
lines.length > 0 && | ||
(0, utils_1.isBlankLine)(lines[lines.length - 1])) { | ||
lines.pop(); | ||
removals++; | ||
} | ||
@@ -11,0 +15,0 @@ return lines.join('\n'); |
{ | ||
"name": "extra-utils", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "Utilities for JavaScript and Typescript", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -140,3 +140,6 @@ # extra-utils | ||
```ts | ||
function removeLeadingBlankLines(text: string): string | ||
function removeLeadingBlankLines( | ||
text: string | ||
, maxRemovals: number = Infinity | ||
): string | ||
``` | ||
@@ -157,3 +160,6 @@ | ||
```ts | ||
function removeTrailingBlankLines(text: string): string | ||
function removeTrailingBlankLines( | ||
text: string | ||
, maxRemovals: number = Infinity | ||
): string | ||
``` | ||
@@ -160,0 +166,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
48485
698
278
0