Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public insert(element: lsif.Vertex | lsif.Edge): void {
if (element.type === lsif.ElementTypes.vertex) {
switch (element.label) {
case lsif.VertexLabels.metaData:
this.handleMetaData(element)
break
case lsif.VertexLabels.document: {
if (!this.projectRoot) {
throw new Error('No metadata defined.')
}
const path = RelateUrl.relate(this.projectRoot.href + '/', new URL(element.uri).href, {
defaultPorts: {},
output: RelateUrl.PATH_RELATIVE,
removeRootTrailingSlash: false,
})
this.documentPaths.set(element.id, path)
this.containsData.set(element.id, new Set())
break
}
// The remaining vertex handlers stash data into an appropriate map. This data
// may be retrieved when an edge that references it is seen, or when a document
// is finalized.
case lsif.VertexLabels.range:
this.rangeData.set(element.id, {
options.minifyURLs = function(text) {
try {
return RelateUrl.relate(text, value);
}
catch (err) {
options.log(err);
return text;
}
};
}
options.minifyURLs = function(text) {
try {
return RelateUrl.relate(text, value);
}
catch (err) {
options.log(err);
return text;
}
};
}
options.minifyURLs = function(text) {
try {
return RelateUrl.relate(text, minifyURLs);
}
catch (err) {
options.log(err);
return text;
}
};
}
options.minifyURLs = function(text) {
try {
return RelateUrl.relate(text, value);
}
catch (err) {
options.log(err);
return text;
}
};
}
options.minifyURLs = function(text) {
try {
return RelateUrl.relate(text, minifyURLs);
}
catch (err) {
options.log(err);
return text;
}
};
}
options.minifyURLs = function(text) {
try {
return RelateUrl.relate(text, minifyURLs);
}
catch (err) {
options.log(err);
return text;
}
};
}
export const relativeUrl = (from: URL, to: URL): string => RelateUrl.relate(from.href, to.href, RELATE_URL_OPTIONS)
options.minifyURLs = function(text) {
try {
return RelateUrl.relate(text, minifyURLs);
}
catch (err) {
options.log(err);
return text;
}
};
}