n3 2.13.10 → 2.13.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -137,10 +137,10 @@ class Literal extends Term {
137
137
 
138
138
  // ### The direction of this literal
139
139
  get direction() {
140
- // Find the last double dash after the closing quote (e.g., '"abc"@en-us--ltr')
140
+ // Find the last double dash after the closing quote and language tag (e.g., '"abc"@en-us--ltr')
141
141
  const id = this.id;
142
142
  const endPos = id.lastIndexOf('"');
143
- const dirPos = id.lastIndexOf('--');
143
+ const dirPos = id[endPos + 1] === '@' ? id.lastIndexOf('--') : -1;
144
144
  return dirPos > endPos && dirPos + 2 < id.length ? id.substr(dirPos + 2).toLowerCase() : '';
145
145
  }
146
146
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n3",
3
- "version": "2.13.10",
3
+ "version": "2.13.11",
4
4
  "description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.",
5
5
  "author": "Ruben Verborgh <ruben.verborgh@gmail.com>",
6
6
  "keywords": [
@@ -125,10 +125,10 @@ export class Literal extends Term {
125
125
 
126
126
  // ### The direction of this literal
127
127
  get direction() {
128
- // Find the last double dash after the closing quote (e.g., '"abc"@en-us--ltr')
128
+ // Find the last double dash after the closing quote and language tag (e.g., '"abc"@en-us--ltr')
129
129
  const id = this.id;
130
130
  const endPos = id.lastIndexOf('"');
131
- const dirPos = id.lastIndexOf('--');
131
+ const dirPos = id[endPos + 1] === '@' ? id.lastIndexOf('--') : -1;
132
132
  return dirPos > endPos && dirPos + 2 < id.length ? id.substr(dirPos + 2).toLowerCase() : '';
133
133
  }
134
134