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