wasm-rquickjs-cli 0.5.3

Tool for wrapping JavaScript modules as WebAssembly components using the QuickJS engine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import assert from 'assert';
import Mustache from 'mustache';

export const run = () => {
  const template = 'Hello, {{name}}! Escaped={{unsafe}} Raw={{{unsafe}}}';
  const view = {
    name: 'Mustache',
    unsafe: '<b>&"</b>',
  };

  const out = Mustache.render(template, view);
  assert.strictEqual(out, 'Hello, Mustache! Escaped=&lt;b&gt;&amp;&quot;&lt;&#x2F;b&gt; Raw=<b>&"</b>');

  return 'PASS: basic render escapes HTML and supports triple-mustache raw output';
};