Skip to content

Commit

Permalink
Merge pull request qrohlf#75 from wordbots/master
Browse files Browse the repository at this point in the history
Avoid false positives in Node environment check
  • Loading branch information
qrohlf authored Aug 15, 2017
2 parents 049ae6c + d682083 commit 898a97c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ function Pattern(polys, opts) {
function render_canvas(canvas) {
// check for canvas support
var ctx;
if (typeof process !== "undefined") {
if (typeof process === 'object' &&
typeof process.versions === 'object' &&
typeof process.versions.node !== 'undefined') {
// In Node environment.
try {
require('canvas');
} catch (e) {
Expand Down

0 comments on commit 898a97c

Please sign in to comment.