mirror of
https://github.com/Sevichecc/Urara-Blog.git
synced 2025-05-06 09:09:13 +08:00
29 lines
547 B
Text
29 lines
547 B
Text
'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
|
|
});
|