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": {