How to use the html-entities.encode function in html-entities

To help you get started, we’ve selected a few html-entities examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github discourse / discourse / app / assets / javascripts / discourse / lib / bootstrap-json / index.js View on Github external
Object.keys(bootstrap.setup_data).forEach((sd) => {
    let val = bootstrap.setup_data[sd];
    if (val) {
      if (Array.isArray(val)) {
        val = JSON.stringify(val);
      } else {
        val = val.toString();
      }
      setupData += ` data-${sd.replace(/\_/g, "-")}="${encode(val)}"`;
    }
  });
  buffer.push(``);
github discourse / discourse / app / assets / javascripts / discourse / lib / bootstrap-json / index.js View on Github external
function preloaded(buffer, bootstrap) {
  buffer.push(
    `<div data-preloaded="${encode(
      JSON.stringify(bootstrap.preloaded)
    )}" id="data-preloaded" class="hidden"></div>`
  );
}