Skip to content

Commit e89c185

Browse files
committedFeb 19, 2023
Optimize stringToTerm for named nodes
1 parent 5d03b5a commit e89c185

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎lib/TermUtil.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export function stringToTerm(value: string | undefined, dataFactory?: RDF.DataFa
107107
return dataFactory.literal(getLiteralValue(value), language || type);
108108
case '<':
109109
default:
110-
if (value.startsWith('<<') && value.endsWith('>>')) {
110+
if (value[0] === '<' && value.length > 4 && value[1] === '<' && value[value.length - 1] === '>' && value[value.length - 2] === '>') {
111111
// Iterate character-by-character to detect spaces that are *not* wrapped in <<>>
112112
const terms = value.slice(2, -2).trim();
113113
let stringTerms: string[] = [];

0 commit comments

Comments
 (0)
Please sign in to comment.