Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Apr 6, 2024 via pnpm

lines-and-columns 1.2.4

Maps lines and columns to character offsets and back.
Package summary
Share
0
issues
1
license
1
MIT
Package created
2 Dec 2015
Version published
21 Nov 2021
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
lines-and-columns@1.2.4
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of lines-and-columns 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does lines-and-columns do?

The npm package "lines-and-columns" is designed to map lines and columns to character offsets and vice versa. This is incredibly useful for parsers and other text processes, particularly those that deal in character ranges but need to process text with meaningful lines and columns.

How do you use lines-and-columns?

To utilize "lines-and-columns", first, install it with npm install command as such: npm install --save lines-and-columns. Once installed, you can import the package with import { LinesAndColumns } from 'lines-and-columns'. Hereafter, instantiate the class with a string, creating a new instance. To convert character offset to line and column, use lines.locationForIndex(), and to convert line and column to character offset, use lines.indexForLocation().

A usage example could be:

import { LinesAndColumns } from 'lines-and-columns';

const lines = new LinesAndColumns(
  `table {
  border: 0
}`
);

console.log(lines.locationForIndex(9)); // { line: 1, column: 1 }
console.log(lines.indexForLocation({ line: 1, column: 2 })); // 10

Where are the lines-and-columns docs?

The documentation for "lines-and-columns" can be found on GitHub at git+https://github.com/eventualbuddha/lines-and-columns.git. Details related to installation, usage, and licensing can be found within the README file right here.