How to use detergent - 1 common examples

To help you get started, we’ve selected a few detergent 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 maxlapides / dovetailer / lib / handlebars.js View on Github external
function markdownObj(data) {
  // string
  if (_.isString(data)) {
    if (data.startsWith('mailto:')) return data

    // clean with detergent then parse as markdown
    const cleanData = detergent(data, { addMissingSpaces: false }).res
    return marked(cleanData, { renderer })
  }

  // error case: bad data
  if (!data) {
    logger.error(`Bad JSON! ${data} is not parsable as Markdown.`)
    return {}
  }

  // array
  if (_.isArray(data)) {
    return data.map(markdownObj)
  }

  // object
  return _.reduce(

detergent

Extract, clean, encode text and fix English style

MIT
Latest version published 30 days ago

Package Health Score

66 / 100
Full package analysis

Popular detergent functions