From c1a861ee4a626a9405c9ad3424703ea802f75c3b Mon Sep 17 00:00:00 2001 From: Colle Date: Wed, 18 May 2016 19:18:25 +0200 Subject: [PATCH] Fix for ... in loop to follow javascript best practices http://code.tutsplus.com/tutorials/24-javascript-best-practices-for-beginners--net-5399 --- imagemagick.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/imagemagick.js b/imagemagick.js index b846c0c..233b31f 100644 --- a/imagemagick.js +++ b/imagemagick.js @@ -108,7 +108,7 @@ function parseIdentify(input) { lines.shift(); //drop first line (Image: name.jpg) - for (i in lines) { + for (i in lines) if(lines.hasOwnProperty(i)) { currentLine = lines[i]; indent = currentLine.search(/\S/); if (indent >= 0) { @@ -356,7 +356,7 @@ exports.resizeArgs = function(options) { // check options if (typeof options !== 'object') throw new Error('first argument must be an object'); - for (var k in opt) if (k in options) opt[k] = options[k]; + for (var k in opt) if (k in options && opt.hasOwnProperty(k)) opt[k] = options[k]; if (!opt.srcPath && !opt.srcData) throw new Error('both srcPath and srcData are empty');