source:
trip-planner-front/node_modules/lines-and-columns/README.md@
76712b2
Last change on this file since 76712b2 was e29cc2e, checked in by , 3 years ago | |
---|---|
|
|
File size: 533 bytes |
Rev | Line | |
---|---|---|
[6a3a178] | 1 | # lines-and-columns |
2 | ||
3 | Maps lines and columns to character offsets and back. This is useful for parsers | |
4 | and other text processors that deal in character ranges but process text with | |
5 | meaningful lines and columns. | |
6 | ||
7 | ## Install | |
8 | ||
9 | ``` | |
10 | $ npm install [--save] lines-and-columns | |
11 | ``` | |
12 | ||
13 | ## Usage | |
14 | ||
15 | ```js | |
[e29cc2e] | 16 | import { LinesAndColumns } from 'lines-and-columns' |
[6a3a178] | 17 | |
18 | const lines = new LinesAndColumns( | |
[e29cc2e] | 19 | `table { |
[6a3a178] | 20 | border: 0 |
[e29cc2e] | 21 | }` |
22 | ) | |
[6a3a178] | 23 | |
[e29cc2e] | 24 | lines.locationForIndex(9) |
25 | // { line: 1, column: 1 } | |
26 | ||
27 | lines.indexForLocation({ line: 1, column: 2 }) | |
28 | // 10 | |
[6a3a178] | 29 | ``` |
30 | ||
31 | ## License | |
32 | ||
33 | MIT |
Note:
See TracBrowser
for help on using the repository browser.