Socket
Socket
Sign inDemoInstall

tap-yaml

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tap-yaml - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

lib/types/timestamp.js

28

lib/types/date.js

@@ -1,17 +0,21 @@

const {stringifyString} = require('yaml/util')
module.exports = {
tag: '!date',
identify: value => value instanceof Date,
resolve (doc, cst) {
const src = cst.strValue
const match = src.match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)$/)
if (!match)
// use !!timestamp instead, this is for parsing only
/* c8 ignore start */
/* istanbul ignore next */
identify () {
return false
},
/* c8 ignore stop */
resolve (src) {
const d = new Date(src)
const t = d.getTime()
/* istanbul ignore else */
if (t !== t) {
throw new Error(`Invalid date string: ${src}`)
return new Date(src)
}
return d
},
stringify (item, ctx, onComment, onChompKeep) {
const value = item.value.toISOString()
return stringifyString({ value }, ctx, onComment, onChompKeep)
}
}

@@ -1,11 +0,22 @@

const types = require('yaml/types')
const {
regexp,
sharedSymbol,
symbol,
nullobject,
error,
classTag,
functionTag,
} = require('yaml-types')
module.exports = [
require('./error.js'),
require('./symbol.js'),
require('./shared-symbol.js'),
require('./function.js'),
require('./regexp.js'),
regexp,
sharedSymbol,
symbol,
nullobject,
error,
classTag,
functionTag,
require('./timestamp.js'),
require('./date.js'),
require('./domain.js'),
require('./null-object.js'),
'omap',

@@ -12,0 +23,0 @@ 'set',

{
"name": "tap-yaml",
"version": "1.0.2",
"version": "2.0.0",
"description": "Yaml handling for TAP parsers and generators",

@@ -26,6 +26,7 @@ "main": "lib/index.js",

"dependencies": {
"yaml": "^1.10.2"
"yaml": "^2.3.0",
"yaml-types": "^0.2.0"
},
"devDependencies": {
"tap": "^16.3.0"
"tap": "^16.3.4"
},

@@ -32,0 +33,0 @@ "files": [

@@ -37,5 +37,1 @@ # tap-yaml

since that's often a performance issue.
8. `Date` objects are given a non-default `!date` tag rather than the default
YAML 1.1 `!timestamp`, so that they maintain their explicit date object
nature through stringifying and re-parsing.
9. The `prettyErrors` option is always enabled.
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc