MCPcopy Index your code
hub / github.com/postcss/postcss / getLineToIndex

Function getLineToIndex

lib/input.js:17–30  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

15let pathAvailable = Boolean(resolve && isAbsolute)
16
17function getLineToIndex(input) {
18 if (input[lineToIndexCache]) return input[lineToIndexCache]
19 let lines = input.css.split('\n')
20 let lineToIndex = new Array(lines.length)
21 let prevIndex = 0
22
23 for (let i = 0, l = lines.length; i < l; i++) {
24 lineToIndex[i] = prevIndex
25 prevIndex += lines[i].length + 1
26 }
27
28 input[lineToIndexCache] = lineToIndex
29 return lineToIndex
30}
31
32class Input {
33 get from() {

Callers 2

fromLineAndColumnMethod · 0.85
fromOffsetMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…