(opts = {})
| 209 | } |
| 210 | |
| 211 | positionBy(opts = {}) { |
| 212 | let inputString = |
| 213 | 'document' in this.source.input |
| 214 | ? this.source.input.document |
| 215 | : this.source.input.css |
| 216 | let pos = { |
| 217 | column: this.source.start.column, |
| 218 | line: this.source.start.line, |
| 219 | offset: sourceOffset(inputString, this.source.start) |
| 220 | } |
| 221 | if (opts.index) { |
| 222 | pos = this.positionInside(opts.index) |
| 223 | } else if (opts.word) { |
| 224 | let stringRepresentation = inputString.slice( |
| 225 | sourceOffset(inputString, this.source.start), |
| 226 | sourceOffset(inputString, this.source.end) |
| 227 | ) |
| 228 | let index = stringRepresentation.indexOf(opts.word) |
| 229 | if (index !== -1) pos = this.positionInside(index) |
| 230 | } |
| 231 | return pos |
| 232 | } |
| 233 | |
| 234 | positionInside(index) { |
| 235 | let column = this.source.start.column |
no test coverage detected