convert-newline
Advanced tools
Comparing version 0.0.4 to 0.0.5
10
index.js
@@ -21,4 +21,4 @@ "use strict"; | ||
return function(str) { | ||
str = str.replace(crlf, "\n"); | ||
str = str.replace(cr, "\n"); | ||
str = str.replace(crlf, NEWLINES.lf); | ||
str = str.replace(cr, NEWLINES.lf); | ||
return str.replace(lf, newline); | ||
@@ -68,5 +68,5 @@ }; | ||
// insert CR | ||
chunk = "\r" + chunk; | ||
chunk = NEWLINES.cr + chunk; | ||
} | ||
this.lastIsCr = chunk.endsWith("\r"); | ||
this.lastIsCr = (chunk.lastIndexOf(NEWLINES.cr) === (chunk.length - NEWLINES.cr.length)); | ||
if (this.lastIsCr) { | ||
@@ -90,3 +90,3 @@ // strip CR | ||
// insert last CR | ||
this.push(this.converter("\r")); | ||
this.push(this.converter(NEWLINES.cr)); | ||
} | ||
@@ -93,0 +93,0 @@ this.lastIsCr = false; |
{ | ||
"name": "convert-newline", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Unify newline characters to either \\n, \\r\\n, or \\r.", | ||
@@ -9,6 +9,6 @@ "homepage": "https://github.com/takenspc/convert-newline/", | ||
"scripts": { | ||
"coverage": "istanbul cover node_modules/mocha/bin/_mocha -- test.js -R spec", | ||
"coverage": "istanbul cover node_modules/mocha/bin/_mocha -- --require intelli-espower-loader test/ -R spec", | ||
"coveralls": "cat ./coverage/lcov.info | coveralls", | ||
"lint": "eslint .", | ||
"test": "mocha test.js" | ||
"test": "mocha --require intelli-espower-loader test/" | ||
}, | ||
@@ -23,10 +23,15 @@ "repository": { | ||
"devDependencies": { | ||
"buffer-equals": "^1.0.3", | ||
"coveralls": "^2.11.2", | ||
"eslint": "^0.20.0", | ||
"espower-loader": "^0.11.0", | ||
"intelli-espower-loader": "^0.7.0", | ||
"istanbul": "^0.3.13", | ||
"mocha": "^2.2.4" | ||
"mocha": "^2.2.4", | ||
"power-assert": "^0.11.0" | ||
}, | ||
"engines": { | ||
"iojs": "2.0.x" | ||
"node": ">=0.10", | ||
"iojs": ">=2.0" | ||
} | ||
} |
# convert-newline | ||
[![Build Status](https://travis-ci.org/takenspc/convert-newline.svg?branch=master)](https://travis-ci.org/takenspc/convert-newline) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/x4ks2y09jcjfvgw8/branch/master?svg=true)](https://ci.appveyor.com/project/takenspc/convert-newline/branch/master) | ||
[![Coverage Status](https://coveralls.io/repos/takenspc/convert-newline/badge.svg?branch=master)](https://coveralls.io/r/takenspc/convert-newline?branch=master) | ||
@@ -5,0 +6,0 @@ |
Sorry, the diff of this file is not supported yet
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
17099
18
358
88
8
1