Skip to content

Commit

Permalink
Optimize stringToTerm for named nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Feb 19, 2023
1 parent 5d03b5a commit e89c185
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/TermUtil.ts
Expand Up @@ -107,7 +107,7 @@ export function stringToTerm(value: string | undefined, dataFactory?: RDF.DataFa
return dataFactory.literal(getLiteralValue(value), language || type);
case '<':
default:
if (value.startsWith('<<') && value.endsWith('>>')) {
if (value[0] === '<' && value.length > 4 && value[1] === '<' && value[value.length - 1] === '>' && value[value.length - 2] === '>') {
// Iterate character-by-character to detect spaces that are *not* wrapped in <<>>
const terms = value.slice(2, -2).trim();
let stringTerms: string[] = [];
Expand Down

0 comments on commit e89c185

Please sign in to comment.