source: node_modules/yaml/dist/nodes/Scalar.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 759 bytes
Line 
1'use strict';
2
3var identity = require('./identity.js');
4var Node = require('./Node.js');
5var toJS = require('./toJS.js');
6
7const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
8class Scalar extends Node.NodeBase {
9 constructor(value) {
10 super(identity.SCALAR);
11 this.value = value;
12 }
13 toJSON(arg, ctx) {
14 return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);
15 }
16 toString() {
17 return String(this.value);
18 }
19}
20Scalar.BLOCK_FOLDED = 'BLOCK_FOLDED';
21Scalar.BLOCK_LITERAL = 'BLOCK_LITERAL';
22Scalar.PLAIN = 'PLAIN';
23Scalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';
24Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE';
25
26exports.Scalar = Scalar;
27exports.isScalarValue = isScalarValue;
Note: See TracBrowser for help on using the repository browser.