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

Function getLineNumberForPosition

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

Source from the content-addressed store, hash-verified

410
411//this function returns the line number for the character at the given index
412function getLineNumberForPosition(xmlData, index) {
413 const lines = xmlData.substring(0, index).split(/\r?\n/);
414 return {
415 line: lines.length,
416
417 // column number is last line's length + 1, because column numbering starts at 1:
418 col: lines[lines.length - 1].length + 1
419 };
420}
421
422//this function returns the position of the first character of match within attrStr
423function getPositionFromMatch(match) {

Callers 2

validateFunction · 0.85
readPIFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected