MCPcopy Create free account
hub / github.com/NaturalIntelligence/fast-xml-parser / getLineNumberForPosition

Function getLineNumberForPosition

src/validator.js:504–512  ·  view source on GitHub ↗
(xmlData, index)

Source from the content-addressed store, hash-verified

502
503//this function returns the line number for the character at the given index
504function getLineNumberForPosition(xmlData, index) {
505 const lines = xmlData.substring(0, index).split(/\r?\n/);
506 return {
507 line: lines.length,
508
509 // column number is last line's length + 1, because column numbering starts at 1:
510 col: lines[lines.length - 1].length + 1
511 };
512}
513
514//this function returns the position of the first character of match within attrStr
515function getPositionFromMatch(match) {

Callers 2

validateFunction · 0.85
readPIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected