source: node_modules/@swagger-api/apidom-ast/es/json/nodes/JsonString.mjs@ e48199a

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

Initial commit

  • Property mode set to 100644
File size: 467 bytes
Line 
1import JsonNode from "./JsonNode.mjs";
2import { isEscapeSequence, isStringContent } from "./predicates.mjs";
3class JsonString extends JsonNode {
4 static type = 'string';
5 get value() {
6 if (this.children.length === 1) {
7 const onlyChild = this.children[0];
8 return onlyChild.value;
9 }
10 return this.children.filter(node => isStringContent(node) || isEscapeSequence(node)).reduce((acc, cur) => acc + cur.value, '');
11 }
12}
13export default JsonString;
Note: See TracBrowser for help on using the repository browser.