All files / node_modules/js-yaml/lib/js-yaml/type set.js

57.14% Statements 4/7
0% Branches 0/2
100% Functions 0/0
57.14% Lines 4/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 301x   1x   1x                                       1x          
'use strict';
 
var Type = require('../type');
 
var _hasOwnProperty = Object.prototype.hasOwnProperty;
 
function resolveYamlSet(data) {
  if (data === null) return true;
 
  var key, object = data;
 
  for (key in object) {
    if (_hasOwnProperty.call(object, key)) {
      if (object[key] !== null) return false;
    }
  }
 
  return true;
}
 
function constructYamlSet(data) {
  return data !== null ? data : {};
}
 
module.exports = new Type('tag:yaml.org,2002:set', {
  kind: 'mapping',
  resolve: resolveYamlSet,
  construct: constructYamlSet
});