Comparing version
13
index.js
@@ -112,2 +112,3 @@ // YAML.node, © 2012 Stéphan Kochen | ||
canParseFloatRe = /^[-+]?(\d[\d_]*)?\.[\d_]*(e[-+]\d+)?$/i, | ||
octalRe = /^[-+]?0\d/, | ||
nullRe = /^(~|null)$/i, | ||
@@ -186,6 +187,10 @@ trueRe = /^(y|yes|true|on)$/i, | ||
// Regular numbers. | ||
if (canParseIntRe.test(v)) | ||
return parseInt(v.replace(underscoresRe, ''), 0); | ||
if (canParseFloatRe.test(v)) | ||
return parseFloat(v.replace(underscoresRe, '')); | ||
if (canParseIntRe.test(v)) { | ||
v = v.replace(underscoresRe, ''); | ||
return parseInt(v, octalRe.test(v) ? 8 : 0); | ||
} | ||
if (canParseFloatRe.test(v)) { | ||
v = v.replace(underscoresRe, ''); | ||
return parseFloat(v); | ||
} | ||
@@ -192,0 +197,0 @@ // Times. |
{ | ||
"name": "libyaml", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Bindings to libYAML", | ||
@@ -23,3 +23,3 @@ | ||
"underscore": "1", | ||
"tap": "0.2" | ||
"tap": "0.4" | ||
}, | ||
@@ -26,0 +26,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2787905
01235
0.41%