New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

count-lines

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

count-lines - npm Package Compare versions

Comparing version 0.1.0 to 0.1.2

bower.json

6

index.js

@@ -14,2 +14,8 @@ /*!

function count (str) {
if (typeof str !== 'string') {
throw new Error('count-lines expects a string.');
}
if (!str.length) {
return 0;
}
return str.split(/\r?\n/g).length;

@@ -16,0 +22,0 @@ }

2

package.json
{
"name": "count-lines",
"description": "Count the lines in a string, works with windows carriage returns or unix style newlines.",
"version": "0.1.0",
"version": "0.1.2",
"homepage": "https://github.com/jonschlinkert/count-lines",

@@ -6,0 +6,0 @@ "author": {

@@ -14,2 +14,8 @@ /*!

describe('count', function () {
it('should return zero when the string is empty.', function () {
var actual = count('');
assert.equal(actual, 0);
assert.notEqual(actual, 4);
});
it('should count lines', function () {

@@ -21,3 +27,9 @@ var actual = count('a\nb\nc');

it('should count lines with carriage returns', function () {
it('should include trailing newlines', function () {
var actual = count('a\nb\nc\n');
assert.equal(actual, 4);
assert.notEqual(actual, 5);
});
it('should work with carriage returns', function () {
var actual = count('a\r\nb\r\nc');

@@ -27,2 +39,8 @@ assert.equal(actual, 3);

});
it('should include trailing carriage returns', function () {
var actual = count('a\r\nb\r\nc\r\n');
assert.equal(actual, 4);
assert.notEqual(actual, 5);
});
});
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