Socket
Socket
Sign inDemoInstall

extra-utils

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-utils - npm Package Compare versions

Comparing version 3.6.0 to 3.7.0

2

lib/string/remove-leading-blank-lines.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc