Socket
Socket
Sign inDemoInstall

yaml

Package Overview
Dependencies
0
Maintainers
0
Versions
85
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.2.0

examples/dates.yaml

5

History.md
0.2.0 / 2011-05-21
==================
* Added support for dates [Adrian Olaru]
0.1.1 / 2010-12-15

@@ -3,0 +8,0 @@ ==================

28

lib/yaml.js

@@ -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 @@ *

2

package.json
{ "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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc