From ce61ae06da77652c3acf1e9a89ed3cc01fe221ac Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Mon, 26 Aug 2013 19:15:55 +0200 Subject: [PATCH] make sure opts keys are good --- index.js | 2 +- test.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a304e0f..29d8a7e 100644 --- a/index.js +++ b/index.js @@ -20,7 +20,7 @@ function Screenshot(url, opts) { this.format('png'); Object.keys(opts || {}).forEach(function (key) { - this[key](opts[key]); + if (typeof this[key] == 'function') this[key](opts[key]); }.bind(this)); } diff --git a/test.js b/test.js index fd8a830..78596dc 100644 --- a/test.js +++ b/test.js @@ -35,12 +35,14 @@ var server = http.createServer(function(req, res) { width: 1024, height: 768, timeout: 100, - format: 'jpeg' + format: 'jpeg', + url: 'trololo' }); t.equal(s._width, 1024); t.equal(s._height, 768); t.equal(s._timeout, 100); t.equal(s._format, 'JPG'); + t.equal(s.url, url); t.end(); });