rdf-validate-datatype
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "rdf-validate-datatype", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Validate literal value of an RDF term based on its datatype.", |
@@ -83,3 +83,3 @@ import { csvw, rdf, xsd } from '@tpluscode/rdf-ns-builders'; | ||
value === 'false')); | ||
const decimalSeg = `${signSeg}\\d+(\\.\\d+)?`; | ||
const decimalSeg = `${signSeg}(\\d+\\.?\\d*|\\.\\d+)`; | ||
const decimalPattern = new RegExp(`^${signSeg}${decimalSeg}$`); | ||
@@ -86,0 +86,0 @@ validators.register(xsd.decimal, value => decimalPattern.test(value)); |
@@ -166,8 +166,18 @@ import assert from 'assert'; | ||
['test', xsd.boolean, false], | ||
['0.4', xsd.decimal, true], | ||
['244.14', xsd.decimal, true], | ||
['0', xsd.decimal, true, 'zero'], | ||
['0.4', xsd.decimal, true, 'decimal point'], | ||
['244.14', xsd.decimal, true, 'with decimal digits'], | ||
['244', xsd.decimal, true, 'without decimal digits'], | ||
['-24.4', xsd.decimal, true, 'minus sign'], | ||
['+24.4', xsd.decimal, true, 'plus sign'], | ||
['test', xsd.decimal, false], | ||
['test', xsd.decimal, false, 'non-numeric characters'], | ||
['NaN', xsd.decimal, false, 'NaN'], | ||
['.4', xsd.decimal, true, 'leading decimal point'], | ||
['4.', xsd.decimal, true, 'trailing decimal point'], | ||
['003.500', xsd.decimal, true, 'leading zeros'], | ||
['-003.500', xsd.decimal, true, 'negative number with leading zeros'], | ||
['+003.500', xsd.decimal, true, 'positive number with leading zeros'], | ||
['3.0000', xsd.decimal, true, 'trailing zeros'], | ||
['3,5', xsd.decimal, false, 'comma instead of decimal point'], | ||
['24.4.4', xsd.decimal, false, 'two decimal points'], | ||
['-1E4', xsd.float, true], | ||
@@ -174,0 +184,0 @@ ['1267.43233E12', xsd.float, true], |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
36471
702
0