summaryrefslogtreecommitdiff
path: root/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js')
-rw-r--r--node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js b/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
new file mode 100644
index 0000000..1ced791
--- /dev/null
+++ b/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
@@ -0,0 +1,26 @@
+import { Scalar } from '../../nodes/Scalar.js';
+
+function boolStringify({ value, source }, ctx) {
+ const boolObj = value ? trueTag : falseTag;
+ if (source && boolObj.test.test(source))
+ return source;
+ return value ? ctx.options.trueStr : ctx.options.falseStr;
+}
+const trueTag = {
+ identify: value => value === true,
+ default: true,
+ tag: 'tag:yaml.org,2002:bool',
+ test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
+ resolve: () => new Scalar(true),
+ stringify: boolStringify
+};
+const falseTag = {
+ identify: value => value === false,
+ default: true,
+ tag: 'tag:yaml.org,2002:bool',
+ test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
+ resolve: () => new Scalar(false),
+ stringify: boolStringify
+};
+
+export { falseTag, trueTag };