(source)
| 188 | return toString.call(thing) === '[object Object]'; |
| 189 | } |
| 190 | function getLocator(source) { |
| 191 | const originalLines = source.split('\n'); |
| 192 | const lineOffsets = []; |
| 193 | for (let i = 0, pos = 0; i < originalLines.length; i++) { |
| 194 | lineOffsets.push(pos); |
| 195 | pos += originalLines[i].length + 1; |
| 196 | } |
| 197 | return function locate(index) { |
| 198 | let i = 0; |
| 199 | let j = lineOffsets.length; |
| 200 | while (i < j) { |
| 201 | const m = (i + j) >> 1; |
| 202 | if (index < lineOffsets[m]) { |
| 203 | j = m; |
| 204 | } else { |
| 205 | i = m + 1; |
| 206 | } |
| 207 | } |
| 208 | const line = i - 1; |
| 209 | const column = index - lineOffsets[line]; |
| 210 | return { line, column }; |
| 211 | }; |
| 212 | } |
| 213 | class Mappings { |
| 214 | constructor(hires) { |
| 215 | this.hires = hires; |
no test coverage detected