Socket
Socket
Sign inDemoInstall

js-yaml

Package Overview
Dependencies
3
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

6

HISTORY.md

@@ -0,1 +1,7 @@

2.0.1 / 2013-02-09
------------------
* Fixed error, when options not passed to function cass
2.0.0 / 2013-02-09

@@ -2,0 +8,0 @@ ------------------

35

lib/js-yaml/common.js
'use strict';
var YAMLException = require('./exception');
var NIL = {};

@@ -31,28 +28,14 @@

function getSetting(settings, name) {
if (!isNothing(settings) && !isNothing(settings[name])) {
return settings[name];
} else {
throw new YAMLException('Required "' + name + '" setting is missed.');
}
}
function extend(target, source) {
var index, length, key, sourceKeys;
if (source) {
sourceKeys = Object.keys(source);
function getOption(options, name, alternative) {
if (!isNothing(options) && !isNothing(options[name])) {
return options[name];
} else {
return alternative;
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
key = sourceKeys[index];
target[key] = source[key];
}
}
}
function extend(target, source) {
var index, length, key, sourceKeys = Object.keys(source);
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
key = sourceKeys[index];
target[key] = source[key];
}
return target;

@@ -77,5 +60,3 @@ }

module.exports.toArray = toArray;
module.exports.getSetting = getSetting;
module.exports.getOption = getOption;
module.exports.repeat = repeat;
module.exports.extend = extend;

@@ -128,8 +128,10 @@ 'use strict';

function dump(input, settings) {
var schema = common.getOption(settings, 'schema', DEFAULT_SCHEMA),
indent = Math.max(1, common.getOption(settings, 'indent', 2)),
flowLevel = common.getOption(settings, 'flowLevel', -1),
styleMap = compileStyleMap(schema, common.getOption(settings, 'styles', null)),
function dump(input, options) {
options = options || {};
var schema = options['schema'] || DEFAULT_SCHEMA,
indent = Math.max(1, (options['indent'] || 2)),
flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']),
styleMap = compileStyleMap(schema, options['styles'] || null),
implicitTypes = schema.compiledImplicit,

@@ -430,4 +432,4 @@ explicitTypes = schema.compiledExplicit,

function safeDump(input, settings) {
return dump(input, common.extend({ schema: SAFE_SCHEMA }, settings));
function safeDump(input, options) {
return dump(input, common.extend({ schema: SAFE_SCHEMA }, options));
}

@@ -434,0 +436,0 @@

@@ -117,10 +117,12 @@ 'use strict';

function loadAll(input, output, settings) {
var filename = common.getOption(settings, 'filename', null),
schema = common.getOption(settings, 'schema', DEFAULT_SCHEMA),
resolve = common.getOption(settings, 'resolve', true),
validate = common.getOption(settings, 'validate', true),
strict = common.getOption(settings, 'strict', false),
legacy = common.getOption(settings, 'legacy', false),
function loadAll(input, output, options) {
options = options || {};
var filename = options['filename'] || null,
schema = options['schema'] || DEFAULT_SCHEMA,
resolve = options['resolve'] || true,
validate = options['validate'] || true,
strict = options['strict'] || false,
legacy = options['legacy'] || false,
directiveHandlers = {},

@@ -1517,3 +1519,3 @@ implicitTypes = schema.compiledImplicit,

function load(input, settings) {
function load(input, options) {
var result = null, received = false;

@@ -1530,3 +1532,3 @@

loadAll(input, callback, settings);
loadAll(input, callback, options);

@@ -1537,9 +1539,9 @@ return result;

function safeLoadAll(input, output, settings) {
loadAll(input, output, common.extend({ schema: SAFE_SCHEMA }, settings));
function safeLoadAll(input, output, options) {
loadAll(input, output, common.extend({ schema: SAFE_SCHEMA }, options));
}
function safeLoad(input, settings) {
return load(input, common.extend({ schema: SAFE_SCHEMA }, settings));
function safeLoad(input, options) {
return load(input, common.extend({ schema: SAFE_SCHEMA }, options));
}

@@ -1546,0 +1548,0 @@

'use strict';
var common = require('./common');
var YAMLException = require('./exception');

@@ -9,6 +8,8 @@

// TODO: Add tag format check.
function Type(tag, settings) {
function Type(tag, options) {
options = options || {};
this.tag = tag;
this.loader = common.getOption(settings, 'loader', null);
this.dumper = common.getOption(settings, 'dumper', null);
this.loader = options['loader'] || null;
this.dumper = options['dumper'] || null;

@@ -29,6 +30,8 @@ if (null === this.loader && null === this.dumper) {

Type.Loader = function TypeLoader(settings) {
this.kind = common.getSetting(settings, 'kind');
this.resolver = common.getOption(settings, 'resolver', null);
Type.Loader = function TypeLoader(options) {
options = options || {};
this.kind = options['kind'] || null;
this.resolver = options['resolver'] || null;
if ('string' !== this.kind &&

@@ -57,10 +60,12 @@ 'array' !== this.kind &&

Type.Dumper = function TypeDumper(settings) {
this.kind = common.getSetting(settings, 'kind');
this.defaultStyle = common.getOption(settings, 'defaultStyle', null);
this.instanceOf = common.getOption(settings, 'instanceOf', null);
this.predicate = common.getOption(settings, 'predicate', null);
this.representer = common.getOption(settings, 'representer', null);
this.styleAliases = compileAliases(common.getOption(settings, 'styleAliases', null));
Type.Dumper = function TypeDumper(options) {
options = options || {};
this.kind = options['kind'] || null;
this.defaultStyle = options['defaultStyle'] || null;
this.instanceOf = options['instanceOf'] || null;
this.predicate = options['predicate'] || null;
this.representer = options['representer'] || null;
this.styleAliases = compileAliases(options['styleAliases'] || null);
if ('undefined' !== this.kind &&

@@ -67,0 +72,0 @@ 'null' !== this.kind &&

{
"name" : "js-yaml",
"version" : "2.0.0",
"version" : "2.0.1",
"description" : "YAML 1.2 parser and serializer",

@@ -5,0 +5,0 @@ "keywords" : ["yaml", "parser", "serializer", "pyyaml"],

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