MCPcopy Index your code
hub / github.com/Moddable-OpenSource/moddable / valueToString

Method valueToString

tools/mcdevicetree.js:1457–1478  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

1455 }
1456
1457 static valueToString(value) {
1458 if (!value) return '';
1459
1460 switch (value.type) {
1461 case 'string':
1462 return `"${value.value}"`;
1463 case 'string-array':
1464 return value.value.map(v => `"${v}"`).join(',\n\t\t ');
1465 case 'number':
1466 return value.value;
1467 case 'reference':
1468 return `&${value.value}`;
1469 case 'array':
1470 return `< ${value.value.join(' ')} >`;
1471 case 'identifier':
1472 return value.value;
1473 case 'mixed-array':
1474 return value.value.map(v => DTSParser.valueToString(v)).join(',\n\t\t ');
1475 default:
1476 return String(value.value || '');
1477 }
1478 }
1479
1480 static filter(tree, callback) {
1481 const selected = [];

Callers 1

nodeToStringMethod · 0.80

Calls 2

StringFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected