Initial commit
[yaffs-website] / node_modules / js-yaml / lib / js-yaml / type / null.js
1 'use strict';
2
3 var Type = require('../type');
4
5 function resolveYamlNull(data) {
6   if (data === null) return true;
7
8   var max = data.length;
9
10   return (max === 1 && data === '~') ||
11          (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
12 }
13
14 function constructYamlNull() {
15   return null;
16 }
17
18 function isNull(object) {
19   return object === null;
20 }
21
22 module.exports = new Type('tag:yaml.org,2002:null', {
23   kind: 'scalar',
24   resolve: resolveYamlNull,
25   construct: constructYamlNull,
26   predicate: isNull,
27   represent: {
28     canonical: function () { return '~';    },
29     lowercase: function () { return 'null'; },
30     uppercase: function () { return 'NULL'; },
31     camelcase: function () { return 'Null'; }
32   },
33   defaultStyle: 'lowercase'
34 });