Improved double check
This commit is contained in:
parent
8e3a95a0c3
commit
9eef604748
|
@ -29,13 +29,13 @@ parser.parse(turtleStream, function (error, triple, prefixes){
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case 'float':
|
case 'float':
|
||||||
case 'double':
|
case 'double':
|
||||||
if (!value.match(/[-+]?\d*[.]\d+/)){
|
if (!(/[-+]?\d*[.]\d+/.test(value))){
|
||||||
console.log('WARNING: datatype does not validate for value ' + value);
|
console.log('WARNING: datatype does not validate for value ' + value);
|
||||||
console.log(triple.subject, triple.predicate, triple.object, '.');
|
console.log(triple.subject, triple.predicate, triple.object, '.');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'int':
|
case 'int':
|
||||||
if (!value.match(/[-+]?\d*/)){
|
if (!(/^\+?(0|[1-9]\d*)$/.test(value))){
|
||||||
console.log('WARNING: int does not validate for value ' + value);
|
console.log('WARNING: int does not validate for value ' + value);
|
||||||
console.log(triple.subject, triple.predicate, triple.object, '.');
|
console.log(triple.subject, triple.predicate, triple.object, '.');
|
||||||
}
|
}
|
||||||
|
|
40
package.json
40
package.json
|
@ -1,15 +1,29 @@
|
||||||
{
|
{
|
||||||
"name": “TurtleValidator",
|
"name": "turtle-validator",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"license": "",
|
"description": "This command line tool validates Turtle documents and does XSD datatype checks",
|
||||||
"bin": {
|
"main": "TurtleValidator.js",
|
||||||
"genmem": "./bin/TurtleValidator"
|
"dependencies": {
|
||||||
},
|
"n3": "~0.2.6"
|
||||||
"dependencies": {
|
},
|
||||||
"n3": "*"
|
"devDependencies": {},
|
||||||
},
|
"scripts": {
|
||||||
"repository": {
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
"type": "git",
|
},
|
||||||
"url": "https://github.com/mmlab/N3Validator.git"
|
"repository": {
|
||||||
}
|
"type": "git",
|
||||||
|
"url": "git://github.com/mmlab/TurtleValidator.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"Turtle",
|
||||||
|
"RDF",
|
||||||
|
"Semantic",
|
||||||
|
"Web"
|
||||||
|
],
|
||||||
|
"author": "Miel Vander Sande",
|
||||||
|
"license": "MIT",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/mmlab/TurtleValidator/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/mmlab/TurtleValidator"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue