Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
generate() {
const { options, tag } = this;
const value = String(this.value);
if (tag === 'canvas') {
QRCode.toCanvas(this.$el, value, options, (error) => {
/* istanbul ignore if */
if (error) {
throw error;
}
});
} else if (tag === 'img') {
QRCode.toDataURL(value, options, (error, url) => {
/* istanbul ignore if */
if (error) {
throw error;
}
this.$el.src = url;
});
} else {
QRCode.toString(value, options, (error, string) => {
/* istanbul ignore if */
if (error) {
throw error;
}
this.$el.innerHTML = string;
});