Comparing version 0.2.2 to 0.2.3
// **N3Util** provides N3 utility functions | ||
var XsdString = 'http://www.w3.org/2001/XMLSchema#string'; | ||
var RdfLangString = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#langString'; | ||
@@ -34,6 +35,6 @@ var N3Util = { | ||
getLiteralType: function (literal) { | ||
var match = /^"(?:.|\n|\r)*"(?:@[\-a-z]+|\^\^<(.+)>)?$/i.exec(literal); | ||
var match = /^"(?:.|\n|\r)*"(?:\^\^<(.+)>|(@)[\-a-z]+)?$/i.exec(literal); | ||
if (!match) | ||
throw new Error(literal + ' is not a literal'); | ||
return match[1] || XsdString; | ||
return match[1] || (match[2] ? RdfLangString : XsdString); | ||
}, | ||
@@ -40,0 +41,0 @@ |
{ | ||
"name": "n3", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.", | ||
@@ -5,0 +5,0 @@ "author": "Ruben Verborgh <ruben.verborgh@gmail.com>", |
@@ -154,3 +154,3 @@ var N3Util = require('../N3').Util; | ||
it('gets the type of a literal with a language', function () { | ||
N3Util.getLiteralType('"English"@en').should.equal('http://www.w3.org/2001/XMLSchema#string'); | ||
N3Util.getLiteralType('"English"@en').should.equal('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString'); | ||
}); | ||
@@ -157,0 +157,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171152
3470