Socket
Socket
Sign inDemoInstall

lines-and-columns

Package Overview
Dependencies
0
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

33

dist/lines-and-columns.cjs.js
'use strict';
const LF = '\n';
const CR = '\r';
class LinesAndColumns {

@@ -7,13 +10,23 @@ constructor(string) {

const offsets = [];
let offset = 0;
while (true) {
offsets.push(offset);
let next = string.indexOf('\n', offset);
if (next < 0) {
break;
} else {
next += '\n'.length;
const offsets = [0];
for (let offset = 0; offset < string.length;) {
switch (string[offset]) {
case LF:
offset += LF.length;
offsets.push(offset);
break;
case CR:
offset += CR.length;
if (string[offset] === LF) {
offset += LF.length;
}
offsets.push(offset);
break;
default:
offset++;
break;
}
offset = next;
}

@@ -20,0 +33,0 @@

@@ -0,1 +1,4 @@

const LF = '\n';
const CR = '\r';
class LinesAndColumns {

@@ -5,13 +8,23 @@ constructor(string) {

const offsets = [];
let offset = 0;
while (true) {
offsets.push(offset);
let next = string.indexOf('\n', offset);
if (next < 0) {
break;
} else {
next += '\n'.length;
const offsets = [0];
for (let offset = 0; offset < string.length;) {
switch (string[offset]) {
case LF:
offset += LF.length;
offsets.push(offset);
break;
case CR:
offset += CR.length;
if (string[offset] === LF) {
offset += LF.length;
}
offsets.push(offset);
break;
default:
offset++;
break;
}
offset = next;
}

@@ -18,0 +31,0 @@

{
"name": "lines-and-columns",
"version": "1.0.1",
"version": "1.0.2",
"description": "Maps lines and columns to character offsets and back.",

@@ -5,0 +5,0 @@ "main": "dist/lines-and-columns.cjs.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc