Comparing version 1.0.2 to 2.0.0
@@ -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. |
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
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
4114
2
9
70
37
1
+ Addedyaml-types@^0.2.0
+ Addedyaml@2.5.1(transitive)
+ Addedyaml-types@0.2.0(transitive)
- Removedyaml@1.10.2(transitive)
Updatedyaml@^2.3.0