How to use is-html - 3 common examples

To help you get started, we’ve selected a few is-html 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 cypress-io / cypress / packages / net-stubbing / lib / server / util.ts View on Github external
function _getFakeClientResponse (opts: {
  statusCode: number
  headers: {
    [k: string]: string
  }
  body: string
}) {
  const clientResponse = new IncomingMessage(new Socket)

  // be nice and infer this content-type for the user
  if (!_.keys(opts.headers).map(_.toLower).includes('content-type') && isHtml(opts.body)) {
    opts.headers['content-type'] = 'text/html'
  }

  _.merge(clientResponse, opts)

  return clientResponse
}
github jxnblk / static-react / test / cli.js View on Github external
process.stdout.on('data', data => {
      const html = data.toString('utf8')
      assert.equal(isHtml(html), true)
      done()
    })
  })
github uphold / uphold-sdk-javascript / src / browser / services / fetch-client.js View on Github external
_parseText(text) {
    if (!text || isHtml(text)) {
      return {};
    }

    try {
      return JSON.parse(text);
    } catch (e) {
      return text;
    }
  }
}

is-html

Check if a string is HTML

MIT
Latest version published 1 month ago

Package Health Score

80 / 100
Full package analysis

Popular is-html functions