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