Comparing version 0.3.2 to 0.3.3
@@ -50,5 +50,6 @@ // Base64 encoder/decoder with UTF-8 support | ||
if (console) { | ||
logger.warn = console.warn || console.error || console.log || noop; | ||
logger.warn = console.error || console.warn || console.log || noop; | ||
if (window.console) { | ||
logger = window.console; | ||
logger.warn = logger.warn || logger.error || logger.log || noop; | ||
logger.error = logger.error || logger.warn || logger.log || noop; | ||
} | ||
@@ -55,0 +56,0 @@ |
@@ -0,1 +1,7 @@ | ||
0.3.3 / 2011-12-20 | ||
------------------ | ||
* jsyaml executable moved to separate module. | ||
* adds `compact` stringification of Errors. | ||
0.3.2 / 2011-12-16 | ||
@@ -2,0 +8,0 @@ ------------------ |
@@ -30,3 +30,3 @@ 'use strict'; | ||
for (i = 1; i < l; i += 1) { | ||
if ('object' === typeof arguments[i]) { | ||
if (!!arguments[i] && 'object' === typeof arguments[i]) { | ||
for (key in arguments[i]) { | ||
@@ -33,0 +33,0 @@ if (arguments[i].hasOwnProperty(key) && -1 === skip.indexOf(key)) { |
@@ -24,3 +24,3 @@ 'use strict'; | ||
'on': true, | ||
'off': false, | ||
'off': false | ||
}; | ||
@@ -210,6 +210,7 @@ | ||
pairs = []; | ||
node.forEachPair(function (key_node, value_node) { | ||
$$.each(node.value, function (pair) { | ||
var key, value; | ||
key = this.constructObject(key_node, deep); | ||
value = this.constructObject(value_node, deep); | ||
key = this.constructObject(pair[0], deep); | ||
value = this.constructObject(pair[1], deep); | ||
pairs.store(key, value); | ||
@@ -216,0 +217,0 @@ }, this); |
@@ -65,3 +65,3 @@ 'use strict'; | ||
Mark.prototype.toString = function () { | ||
Mark.prototype.toString = function (compact) { | ||
var snippet = this.getSnippet(), where; | ||
@@ -73,3 +73,3 @@ | ||
if (snippet) { | ||
if (snippet && !compact) { | ||
where += ':\n' + snippet; | ||
@@ -99,15 +99,17 @@ } | ||
this.toString = function toString() { | ||
this.toString = function toString(compact) { | ||
var lines = []; | ||
if (null !== this.context) { | ||
lines.push(this.context); | ||
} | ||
if (!compact) { | ||
if (null !== this.context) { | ||
lines.push(this.context); | ||
} | ||
if (null !== this.contextMark | ||
&& (null === this.problem || null === this.problemMark | ||
|| this.contextMark.name !== this.problemMark.name | ||
|| this.contextMark.line !== this.problemMark.line | ||
|| this.contextMark.column !== this.problemMark.column)) { | ||
lines.push(this.contextMark.toString()); | ||
if (null !== this.contextMark | ||
&& (null === this.problem || null === this.problemMark | ||
|| this.contextMark.name !== this.problemMark.name | ||
|| this.contextMark.line !== this.problemMark.line | ||
|| this.contextMark.column !== this.problemMark.column)) { | ||
lines.push(this.contextMark.toString()); | ||
} | ||
} | ||
@@ -120,3 +122,3 @@ | ||
if (null !== this.problemMark) { | ||
lines.push(this.problemMark.toString()); | ||
lines.push(this.problemMark.toString(compact)); | ||
} | ||
@@ -128,3 +130,3 @@ | ||
return lines.join('\n'); | ||
return lines.join(compact ? ' ' : '\n'); | ||
}; | ||
@@ -131,0 +133,0 @@ } |
{ | ||
"name" : "js-yaml", | ||
"version" : "0.3.2", | ||
"version" : "0.3.3", | ||
"description" : "YAML 1.1 Parser", | ||
@@ -14,3 +14,2 @@ "keywords" : ["yaml", "parser", "pyyaml"], | ||
"bin" : { "jsyaml": "bin/js-yaml.js" }, | ||
"main" : "./index.js", | ||
@@ -22,2 +21,3 @@ "scripts" : { | ||
"devDependencies" : { | ||
"vows" : "~ 0.6.0", | ||
"jslint" : "https://github.com/reid/node-jslint/tarball/6131ebf5713274871b89735105e3286131804771" | ||
@@ -24,0 +24,0 @@ }, |
@@ -19,4 +19,4 @@ JS-YAML - YAML 1.1 parser for JavaScript | ||
You can install JS-YAML globally (with `-g` npm argument), and use it to inspect | ||
your YAML files: | ||
If you want to inspect your YAML files from CLI, install [js-yaml.bin](https://github.com/nodeca/js-yaml.bin) | ||
and then you'll be able to call it like this: | ||
@@ -23,0 +23,0 @@ ``` |
@@ -1,11 +0,13 @@ | ||
var issue = module.exports = {}, | ||
assert = require('assert'), | ||
jsyaml = require(__dirname + '/../../lib/js-yaml'), | ||
source = __dirname + '/data/issue-17.yml'; | ||
var Assert = require('assert'); | ||
var JsYaml = require('../../lib/js-yaml'); | ||
var source = __dirname + '/data/issue-17.yml'; | ||
issue.title = "#17: Non-specific `!` tags should resolve to !!str"; | ||
issue.fixed = true; | ||
issue.execute = function () { | ||
var str = require(source).shift(); | ||
assert.equal('string', typeof str); | ||
}; | ||
module.exports = require('../helper').issue({ | ||
title: "#17: Non-specific `!` tags should resolve to !!str", | ||
fixed: true, | ||
test: function () { | ||
var str = require(source).shift(); | ||
Assert.equal('string', typeof str); | ||
} | ||
}); |
@@ -1,13 +0,15 @@ | ||
var issue = module.exports = {}, | ||
assert = require('assert'), | ||
jsyaml = require(__dirname + '/../../lib/js-yaml'), | ||
source = __dirname + '/data/issue-19.yml'; | ||
var Assert = require('assert'); | ||
var JsYaml = require('../../lib/js-yaml'); | ||
var source = __dirname + '/data/issue-19.yml'; | ||
issue.title = "#19: Timestamp parsing is one month off"; | ||
issue.fixed = true; | ||
issue.execute = function () { | ||
var doc = require(source).shift(), | ||
expected = new Date(2011, 11, 24); | ||
// JS month starts with 0 (0 => Jan, 1 => Feb, ...) | ||
assert.equal(doc.xmas.getTime(), expected.getTime()); | ||
}; | ||
module.exports = require('../helper').issue({ | ||
title: "#19: Timestamp parsing is one month off", | ||
fixed: true, | ||
test: function () { | ||
var doc = require(source).shift(), expected = new Date(2011, 11, 24); | ||
// JS month starts with 0 (0 => Jan, 1 => Feb, ...) | ||
Assert.equal(doc.xmas.getTime(), expected.getTime()); | ||
} | ||
}); |
@@ -1,11 +0,13 @@ | ||
var issue = module.exports = {}, | ||
assert = require('assert'), | ||
jsyaml = require(__dirname + '/../../lib/js-yaml'), | ||
source = __dirname + '/data/issue-26.yml'; | ||
var Assert = require('assert'); | ||
var JsYaml = require('../../lib/js-yaml'); | ||
var source = __dirname + '/data/issue-26.yml'; | ||
issue.title = "#26: should convert new line into white space"; | ||
issue.fixed = true; | ||
issue.execute = function () { | ||
var doc = require(source).shift(); | ||
assert.equal(doc.test, 'a b c\n'); | ||
}; | ||
module.exports = require('../helper').issue({ | ||
title: "#26: should convert new line into white space", | ||
fixed: true, | ||
test: function () { | ||
var doc = require(source).shift(); | ||
Assert.equal(doc.test, 'a b c\n'); | ||
} | ||
}); |
@@ -1,12 +0,14 @@ | ||
var issue = module.exports = {}, | ||
assert = require('assert'), | ||
jsyaml = require(__dirname + '/../../lib/js-yaml'), | ||
source = __dirname + '/data/issue-8.yml'; | ||
var Assert = require('assert'); | ||
var JsYaml = require('../../lib/js-yaml'); | ||
var source = __dirname + '/data/issue-8.yml'; | ||
issue.title = "#8: Parse failed when no document start present"; | ||
issue.fixed = true; | ||
issue.execute = function () { | ||
assert.doesNotThrow(function () { | ||
require(source).shift(); | ||
}, TypeError); | ||
}; | ||
module.exports = require('../helper').issue({ | ||
title: "#8: Parse failed when no document start present", | ||
fixed: true, | ||
test: function () { | ||
Assert.doesNotThrow(function () { | ||
require(source).shift(); | ||
}, TypeError); | ||
} | ||
}); |
@@ -1,13 +0,17 @@ | ||
var issue = module.exports = {}, | ||
jsyaml = require(__dirname + '/../../lib/js-yaml'), | ||
source = __dirname + '/data/issue-9.yml'; | ||
var Assert = require('assert'); | ||
var JsYaml = require('../../lib/js-yaml'); | ||
var source = __dirname + '/data/issue-9.yml'; | ||
issue.title = "#9: Reader fails on File Resource stream, when file is less than 4KB"; | ||
issue.fixed = true; | ||
issue.execute = function () { | ||
var fs = require('fs'), | ||
fd = fs.openSync(source, 'r'); | ||
jsyaml.load(fd); | ||
fs.closeSync(fd); | ||
}; | ||
module.exports = require('../helper').issue({ | ||
title: "#9: Reader fails on File Resource stream, when file is less than 4KB", | ||
fixed: true, | ||
test: function () { | ||
Assert.doesNotThrow(function () { | ||
var fs = require('fs'), fd = fs.openSync(source, 'r'); | ||
JsYaml.load(fd); | ||
fs.closeSync(fd); | ||
}, Error); | ||
} | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
43
1076225
2
663
15725