1
0
Fork 0
mirror of https://github.com/dawidd6/action-ansible-playbook.git synced 2024-11-23 09:17:19 +00:00
action-ansible-playbook/node_modules/yaml/dist/nodes/Scalar.js

28 lines
759 B
JavaScript
Raw Normal View History

2022-10-21 14:44:44 +00:00
'use strict';
2024-01-17 09:08:10 +00:00
var identity = require('./identity.js');
2022-10-21 14:44:44 +00:00
var Node = require('./Node.js');
var toJS = require('./toJS.js');
const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
class Scalar extends Node.NodeBase {
constructor(value) {
2024-01-17 09:08:10 +00:00
super(identity.SCALAR);
2022-10-21 14:44:44 +00:00
this.value = value;
}
toJSON(arg, ctx) {
return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);
}
toString() {
return String(this.value);
}
}
Scalar.BLOCK_FOLDED = 'BLOCK_FOLDED';
Scalar.BLOCK_LITERAL = 'BLOCK_LITERAL';
Scalar.PLAIN = 'PLAIN';
Scalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';
Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE';
exports.Scalar = Scalar;
exports.isScalarValue = isScalarValue;