Improved double check

This commit is contained in:
Miel Vander Sande 2014-04-21 14:18:02 +02:00
parent 8e3a95a0c3
commit 9eef604748
2 changed files with 29 additions and 15 deletions

View File

@ -29,13 +29,13 @@ parser.parse(turtleStream, function (error, triple, prefixes){
switch(type) {
case 'float':
case 'double':
if (!value.match(/[-+]?\d*[.]\d+/)){
if (!(/[-+]?\d*[.]\d+/.test(value))){
console.log('WARNING: datatype does not validate for value ' + value);
console.log(triple.subject, triple.predicate, triple.object, '.');
}
break;
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(triple.subject, triple.predicate, triple.object, '.');
}

View File

@ -1,15 +1,29 @@
{
"name": TurtleValidator",
"name": "turtle-validator",
"version": "0.1.0",
"license": "",
"bin": {
"genmem": "./bin/TurtleValidator"
},
"description": "This command line tool validates Turtle documents and does XSD datatype checks",
"main": "TurtleValidator.js",
"dependencies": {
"n3": "*"
"n3": "~0.2.6"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/mmlab/N3Validator.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"
}