From 253bc84963e73f5f5674f20c828e3727ced70253 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 29 Jan 2022 01:15:48 +0000 Subject: [PATCH 1/2] Bump trim-off-newlines from 1.0.2 to 1.0.3 Bumps [trim-off-newlines](https://github.com/stevemao/trim-off-newlines) from 1.0.2 to 1.0.3. - [Release notes](https://github.com/stevemao/trim-off-newlines/releases) - [Commits](https://github.com/stevemao/trim-off-newlines/compare/v1.0.2...v1.0.3) --- updated-dependencies: - dependency-name: trim-off-newlines dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2dadb4e6c..fbf62a864 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6075,9 +6075,9 @@ } }, "node_modules/trim-off-newlines": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.2.tgz", - "integrity": "sha512-DAnbtY4lNoOTLw05HLuvPoBFAGV4zOKQ9d1Q45JB+bcDwYIEkCr0xNgwKtygtKFBbRlFA/8ytkAM1V09QGWksg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.3.tgz", + "integrity": "sha512-kh6Tu6GbeSNMGfrrZh6Bb/4ZEHV1QlB4xNDBeog8Y9/QwFlKTRyWvY3Fs9tRDAMZliVUwieMgEdIeL/FtqjkJg==", "dev": true, "engines": { "node": ">=0.10.0" @@ -11062,9 +11062,9 @@ } }, "trim-off-newlines": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.2.tgz", - "integrity": "sha512-DAnbtY4lNoOTLw05HLuvPoBFAGV4zOKQ9d1Q45JB+bcDwYIEkCr0xNgwKtygtKFBbRlFA/8ytkAM1V09QGWksg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.3.tgz", + "integrity": "sha512-kh6Tu6GbeSNMGfrrZh6Bb/4ZEHV1QlB4xNDBeog8Y9/QwFlKTRyWvY3Fs9tRDAMZliVUwieMgEdIeL/FtqjkJg==", "dev": true }, "tsconfig-paths": { From 8e07ec6ce29db78c1b8ec5188ef65acd2abc6922 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 29 Jan 2022 01:33:45 +0000 Subject: [PATCH 2/2] Update checked-in dependencies --- node_modules/.package-lock.json | 6 +++--- node_modules/trim-off-newlines/index.js | 13 +++++++++++-- node_modules/trim-off-newlines/package.json | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index caeabe311..d28a37ad3 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -6019,9 +6019,9 @@ } }, "node_modules/trim-off-newlines": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.2.tgz", - "integrity": "sha512-DAnbtY4lNoOTLw05HLuvPoBFAGV4zOKQ9d1Q45JB+bcDwYIEkCr0xNgwKtygtKFBbRlFA/8ytkAM1V09QGWksg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.3.tgz", + "integrity": "sha512-kh6Tu6GbeSNMGfrrZh6Bb/4ZEHV1QlB4xNDBeog8Y9/QwFlKTRyWvY3Fs9tRDAMZliVUwieMgEdIeL/FtqjkJg==", "dev": true, "engines": { "node": ">=0.10.0" diff --git a/node_modules/trim-off-newlines/index.js b/node_modules/trim-off-newlines/index.js index 9aaa82614..bfd3ba98f 100644 --- a/node_modules/trim-off-newlines/index.js +++ b/node_modules/trim-off-newlines/index.js @@ -1,7 +1,16 @@ 'use strict'; -var regex = /^(?:\r|\n)+|(?:\r|\n)+$/g; +var regex = /[^\r\n]/; module.exports = function (str) { - return str.replace(regex, ''); + var result = str.match(regex); + if (!result) { + return ''; + } + var firstIndex = result.index; + var lastIndex = str.length - 1; + while (str[lastIndex] === '\r' || str[lastIndex] === '\n') { + lastIndex--; + } + return str.substring(firstIndex, lastIndex + 1); }; diff --git a/node_modules/trim-off-newlines/package.json b/node_modules/trim-off-newlines/package.json index 698095b3b..ba6a7fb30 100644 --- a/node_modules/trim-off-newlines/package.json +++ b/node_modules/trim-off-newlines/package.json @@ -1,6 +1,6 @@ { "name": "trim-off-newlines", - "version": "1.0.2", + "version": "1.0.3", "description": "Similar to String#trim() but removes only newlines", "license": "MIT", "repository": "stevemao/trim-off-newlines", @@ -35,7 +35,7 @@ "delete" ], "devDependencies": { - "mocha": "*", + "mocha": "^3.5.3", "xo": "^0.17.1" }, "xo": {