Socket
Socket
Sign inDemoInstall

line-counter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

line-counter - npm Package Compare versions

Comparing version 1.0.0 to 1.0.3

6

CHANGELOG.md

@@ -7,4 +7,8 @@ # Change log

## [Unreleased][unreleased]
## v1.0.3 - 2015-05-11
### Fix
- Issue #1: Endless-Loop calling `.upTo(content.length)` for contents that end with a new-line.
## v1.0.2 - 2015-05-10
### Added
- Initial version of the line-counter module

@@ -70,2 +70,8 @@ /*

this.countUpTo = function (upTo) {
if (upTo >= contents.length) {
throw new Error(
"Index out of bounds! " +
"Index " + upTo + " is not beyound the end of the string."
)
}
if (upTo < startOfLineIndex) {

@@ -72,0 +78,0 @@ throw new Error(

2

package.json
{
"name": "line-counter",
"version": "1.0.0",
"version": "1.0.3",
"description": "A simple class that allows to count lines while iterating over a string",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -97,3 +97,24 @@ var LineCounter = require("../index.js");

));
})
});
it("should throw an error, if `upTo` in an index out of bounds" , function() {
var lc = new LineCounter("abc\ndef");
expect(function() {
lc.countUpTo(7);
}).toThrow(new Error(
"Index out of bounds! " +
"Index 7 is not beyound the end of the string."
));
});
it("should throw an error, if `upTo` in an index out of bounds (for string ending with newline)" , function() {
var lc = new LineCounter("abc\ndef\n");
expect(function() {
lc.countUpTo(8);
}).toThrow(new Error(
"Index out of bounds! " +
"Index 8 is not beyound the end of the string."
));
});
});
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