Comparing version 3.3.1 to 3.4.0
@@ -0,1 +1,11 @@ | ||
3.4.0 / 2015-08-23 | ||
------------------ | ||
- Fixed multiline keys dump, #197. Thanks to @tcr. | ||
- Don't throw on warnongs anymore. Use `onWarning` option to catch. | ||
- Throw error on unknown tags (was warning before). | ||
- Fixed heading line breaks in some scalars (regression). | ||
- Reworked internals of error class. | ||
3.3.1 / 2015-05-13 | ||
@@ -2,0 +12,0 @@ ------------------ |
@@ -211,3 +211,3 @@ 'use strict'; | ||
function writeScalar(state, object, level) { | ||
function writeScalar(state, object, level, iskey) { | ||
var simple, first, spaceWrap, folded, literal, single, double, | ||
@@ -242,3 +242,3 @@ sawLineFeed, linePosition, longestLine, indent, max, character, | ||
// can only use > and | if not wrapped in spaces. | ||
// can only use > and | if not wrapped in spaces or is not a key. | ||
if (spaceWrap) { | ||
@@ -249,4 +249,4 @@ simple = false; | ||
} else { | ||
folded = true; | ||
literal = true; | ||
folded = !iskey; | ||
literal = !iskey; | ||
} | ||
@@ -628,3 +628,3 @@ | ||
if (!writeNode(state, level + 1, objectKey, true, true)) { | ||
if (!writeNode(state, level + 1, objectKey, true, true, true)) { | ||
continue; // Skip this pair because of invalid key. | ||
@@ -708,3 +708,3 @@ } | ||
// | ||
function writeNode(state, level, object, block, compact) { | ||
function writeNode(state, level, object, block, compact, iskey) { | ||
state.tag = null; | ||
@@ -768,3 +768,3 @@ state.dump = object; | ||
if ('?' !== state.tag) { | ||
writeScalar(state, state.dump, level); | ||
writeScalar(state, state.dump, level, iskey); | ||
} | ||
@@ -801,4 +801,3 @@ } else { | ||
function inspectNode(object, objects, duplicatesIndexes) { | ||
var type = _toString.call(object), | ||
objectKeyList, | ||
var objectKeyList, | ||
index, | ||
@@ -805,0 +804,0 @@ length; |
@@ -0,16 +1,31 @@ | ||
// YAML error class. http://stackoverflow.com/questions/8458984 | ||
// | ||
'use strict'; | ||
var inherits = require('util').inherits; | ||
function YAMLException(reason, mark) { | ||
this.name = 'YAMLException'; | ||
this.reason = reason; | ||
this.mark = mark; | ||
this.message = this.toString(false); | ||
// Super constructor | ||
Error.call(this); | ||
// Super helper method to include stack trace in error object | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = 'YAMLException'; | ||
this.reason = reason; | ||
this.mark = mark; | ||
this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); | ||
} | ||
// Inherit from Error | ||
inherits(YAMLException, Error); | ||
YAMLException.prototype.toString = function toString(compact) { | ||
var result; | ||
var result = this.name + ': '; | ||
result = 'JS-YAML: ' + (this.reason || '(unknown reason)'); | ||
result += this.reason || '(unknown reason)'; | ||
@@ -17,0 +32,0 @@ if (!compact && this.mark) { |
@@ -170,8 +170,4 @@ 'use strict'; | ||
function throwWarning(state, message) { | ||
var error = generateError(state, message); | ||
if (state.onWarning) { | ||
state.onWarning.call(null, error); | ||
} else { | ||
throw error; | ||
state.onWarning.call(null, generateError(state, message)); | ||
} | ||
@@ -557,3 +553,3 @@ } | ||
hexResult, | ||
tmp, tmpEsc, | ||
tmp, | ||
ch; | ||
@@ -862,2 +858,3 @@ | ||
// In case of the first content line - count only empty lines. | ||
state.result += common.repeat('\n', emptyLines); | ||
} | ||
@@ -1220,4 +1217,2 @@ | ||
var _position, alias, | ||
len = state.length, | ||
input = state.input, | ||
ch; | ||
@@ -1264,4 +1259,3 @@ | ||
flowIndent, | ||
blockIndent, | ||
_result; | ||
blockIndent; | ||
@@ -1397,3 +1391,3 @@ state.tag = null; | ||
} else { | ||
throwWarning(state, 'unknown tag !<' + state.tag + '>'); | ||
throwError(state, 'unknown tag !<' + state.tag + '>'); | ||
} | ||
@@ -1567,3 +1561,3 @@ } | ||
function load(input, options) { | ||
var documents = loadDocuments(input, options), index, length; | ||
var documents = loadDocuments(input, options); | ||
@@ -1570,0 +1564,0 @@ if (0 === documents.length) { |
@@ -20,3 +20,3 @@ 'use strict'; | ||
var code, idx, bitlen = 0, len = 0, max = data.length, map = BASE64_MAP; | ||
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP; | ||
@@ -41,3 +41,3 @@ // Convert one by one. | ||
function constructYamlBinary(data) { | ||
var code, idx, tailbits, | ||
var idx, tailbits, | ||
input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan | ||
@@ -44,0 +44,0 @@ max = input.length, |
@@ -18,4 +18,2 @@ 'use strict'; | ||
var value, sign, base, digits; | ||
if (!YAML_FLOAT_PATTERN.test(data)) { | ||
@@ -22,0 +20,0 @@ return false; |
@@ -28,5 +28,3 @@ 'use strict'; | ||
var source = '(' + data + ')', | ||
ast = esprima.parse(source, { range: true }), | ||
params = [], | ||
body; | ||
ast = esprima.parse(source, { range: true }); | ||
@@ -33,0 +31,0 @@ if ('Program' !== ast.type || |
@@ -33,3 +33,2 @@ 'use strict'; | ||
try { | ||
var dummy = new RegExp(regexp, modifiers); | ||
return true; | ||
@@ -36,0 +35,0 @@ } catch (error) { |
@@ -22,8 +22,3 @@ 'use strict'; | ||
var match, year, month, day, hour, minute, second, fraction = 0, | ||
delta = null, tz_hour, tz_minute, date; | ||
match = YAML_TIMESTAMP_REGEXP.exec(data); | ||
if (null === match) { | ||
if (YAML_TIMESTAMP_REGEXP.exec(data) === null) { | ||
return false; | ||
@@ -30,0 +25,0 @@ } |
{ | ||
"name": "js-yaml", | ||
"version": "3.3.1", | ||
"version": "3.4.0", | ||
"description": "YAML 1.2 parser and serializer", | ||
@@ -23,2 +23,8 @@ "keywords": [ | ||
}, | ||
"files": [ | ||
"index.js", | ||
"lib/", | ||
"bin/", | ||
"dist/" | ||
], | ||
"bin": { | ||
@@ -34,3 +40,3 @@ "js-yaml": "bin/js-yaml.js" | ||
"benchmark": "*", | ||
"eslint": "0.18.0", | ||
"eslint": "0.24.1", | ||
"eslint-plugin-nodeca": "^1.0.3", | ||
@@ -37,0 +43,0 @@ "istanbul": "*", |
Sorry, the diff of this file is too big to display
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent 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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
289050
7062
37
1
7
3