MCPcopy
hub / github.com/ternjs/tern / invalidDoc

Function invalidDoc

lib/tern.js:546–566  ·  view source on GitHub ↗
(doc)

Source from the content-addressed store, hash-verified

544
545 // Baseline query document validation
546 function invalidDoc(doc) {
547 if (doc.query) {
548 if (typeof doc.query.type != "string") return ".query.type must be a string";
549 if (doc.query.start && !isPosition(doc.query.start)) return ".query.start must be a position";
550 if (doc.query.end && !isPosition(doc.query.end)) return ".query.end must be a position";
551 }
552 if (doc.files) {
553 if (!Array.isArray(doc.files)) return "Files property must be an array";
554 for (var i = 0; i < doc.files.length; ++i) {
555 var file = doc.files[i];
556 if (typeof file != "object") return ".files[n] must be objects";
557 else if (typeof file.name != "string") return ".files[n].name must be a string";
558 else if (file.type == "delete") continue;
559 else if (typeof file.text != "string") return ".files[n].text must be a string";
560 else if (file.type == "part") {
561 if (!isPosition(file.offset) && typeof file.offsetLines != "number")
562 return ".files[n].offset must be a position";
563 } else if (file.type != "full") return ".files[n].type must be \"full\" or \"part\"";
564 }
565 }
566 }
567
568 var offsetSkipLines = 25;
569

Callers 1

tern.jsFile · 0.85

Calls 1

isPositionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…