From 9aa91d7541cfd1dfb4e7fa39eaf18e71f3dbd7b5 Mon Sep 17 00:00:00 2001 From: Houfeng Date: Wed, 23 Mar 2016 00:51:01 +0800 Subject: [PATCH] Specify the context for the execution --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b2b272c..cd99473 100644 --- a/index.js +++ b/index.js @@ -19,12 +19,12 @@ module.exports = thunkify; * @api public */ -function thunkify(fn){ +function thunkify(fn,scope){ assert('function' == typeof fn, 'function required'); return function(){ var args = new Array(arguments.length); - var ctx = this; + var ctx = scope || this; for(var i = 0; i < args.length; ++i) { args[i] = arguments[i];