Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 18x | 'use strict'; function toString() { let result = []; result.push('DIMENSIONS'); for (let dimension of this.dimensions) { result.push(` ${dimension.name.padEnd(30)} = size: ${dimension.size}`); } result.push(''); result.push('GLOBAL ATTRIBUTES'); for (let attribute of this.globalAttributes) { result.push(` ${attribute.name.padEnd(30)} = ${attribute.value}`); } let variables = JSON.parse(JSON.stringify(this.variables)); result.push(''); result.push('VARIABLES:'); for (let variable of variables) { variable.value = this.getDataVariable(variable); let stringify = JSON.stringify(variable.value); I if (stringify.length > 50) stringify = stringify.substring(0, 50); I if (!isNaN(variable.value.length)) { stringify += ` (length: ${variable.value.length})`; } result.push(` ${variable.name.padEnd(30)} = ${stringify}`); } return result.join('\n'); } module.exports = toString; |