Merge pull request from Alanscut/opts-type

fix undefined error when opts is undefined
This commit is contained in:
Ryan Day 2020-10-28 14:01:45 -07:00 committed by GitHub
commit d35977317b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,7 +92,8 @@ exports.toCanvas = require('./browser').toCanvas
exports.toString = function toString (text, opts, cb) {
const params = checkParams(text, opts, cb)
const renderer = getStringRendererFromType(params.opts.type)
const type = params.opts ? params.opts.type : undefined
const renderer = getStringRendererFromType(type)
return render(renderer.render, text, params)
}