Comparing version 0.1.2 to 0.2.0
0.2.0 / 2011-05-21 | ||
================== | ||
* Added support for dates [Adrian Olaru] | ||
0.1.1 / 2010-12-15 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -8,3 +8,3 @@ | ||
exports.version = '0.1.2' | ||
exports.version = '0.2.0' | ||
@@ -45,2 +45,3 @@ // --- Helpers | ||
['string', /^'(.*?)'/], | ||
['timestamp', /^((\d{4})-(\d\d?)-(\d\d?)(?:(?:[ \t]+)(\d\d?):(\d\d)(?::(\d\d))?)?)/], | ||
['float', /^(\d+\.\d+)/], | ||
@@ -238,2 +239,4 @@ ['int', /^(\d+)/], | ||
return this.advanceValue() | ||
case 'timestamp': | ||
return this.parseTimestamp() | ||
case 'float': | ||
@@ -344,2 +347,25 @@ return parseFloat(this.advanceValue()) | ||
/** | ||
* yyyy-mm-dd hh:mm:ss | ||
* | ||
* For full format: http://yaml.org/type/timestamp.html | ||
*/ | ||
Parser.prototype.parseTimestamp = function() { | ||
var token = this.advance()[1] | ||
var date = new Date | ||
var year = token[2] | ||
, month = token[3] | ||
, day = token[4] | ||
, hour = token[5] || 0 | ||
, min = token[6] || 0 | ||
, sec = token[7] || 0 | ||
date.setUTCFullYear(year, month-1, day) | ||
date.setUTCHours(hour) | ||
date.setUTCMinutes(min) | ||
date.setUTCSeconds(sec) | ||
return date | ||
} | ||
/** | ||
* Evaluate a _str_ of yaml. | ||
@@ -346,0 +372,0 @@ * |
{ "name": "yaml", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "Yaml parser", | ||
@@ -4,0 +4,0 @@ "author": "TJ Holowaychuk <tj@vision-media.ca>", |
Sorry, the diff of this file is not supported yet
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
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
2
1
11792
12
341