close

  
<p> var x = acre.require('index');

function violently_coerce_to_string(x) {
  if (x &amp;&amp; typeof x === 'string') {
    return x;
  }
  
  if (x &amp;&amp; typeof x === 'object' &amp;&amp; typeof x._main === 'function') {
    x = x._main();
  }
  var out = null;
  if (x &amp;&amp; typeof x === 'object'
      &amp;&amp; (typeof x.toMarkupList === 'function'
          || typeof x.toMarkup === 'function')) {
            var out = acre.markup.stringify(x);
          }
  if (!out) {
    out = ''+x;
  }
  
  return out;
}

acre.write(violently_coerce_to_string(x));
 </p>

Comments

Hide