Version 1
[yaffs-website] / node_modules / grunt / node_modules / js-yaml / lib / js-yaml / type / null.js
diff --git a/node_modules/grunt/node_modules/js-yaml/lib/js-yaml/type/null.js b/node_modules/grunt/node_modules/js-yaml/lib/js-yaml/type/null.js
new file mode 100644 (file)
index 0000000..6874daa
--- /dev/null
@@ -0,0 +1,34 @@
+'use strict';
+
+var Type = require('../type');
+
+function resolveYamlNull(data) {
+  if (data === null) return true;
+
+  var max = data.length;
+
+  return (max === 1 && data === '~') ||
+         (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
+}
+
+function constructYamlNull() {
+  return null;
+}
+
+function isNull(object) {
+  return object === null;
+}
+
+module.exports = new Type('tag:yaml.org,2002:null', {
+  kind: 'scalar',
+  resolve: resolveYamlNull,
+  construct: constructYamlNull,
+  predicate: isNull,
+  represent: {
+    canonical: function () { return '~';    },
+    lowercase: function () { return 'null'; },
+    uppercase: function () { return 'NULL'; },
+    camelcase: function () { return 'Null'; }
+  },
+  defaultStyle: 'lowercase'
+});