From 9f86b198f993c0e2469fb8cf151ce5baf09ddadd Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Thu, 21 Apr 2016 14:50:01 +0200 Subject: [PATCH] Fix resolvers bug. Fixes #12 --- lib/configure-map.js | 2 +- test/lib/configure-map.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/configure-map.js b/lib/configure-map.js index 522910a..0b2853d 100644 --- a/lib/configure-map.js +++ b/lib/configure-map.js @@ -39,7 +39,7 @@ module.exports = function (original, length, options) { return cache[id]; } } - if (args.length === 1) result = call.call(original, this, arg); + if (args.length === 1) result = call.call(original, this, args[0]); else result = apply.call(original, this, args); if (id === null) { id = get(args); diff --git a/test/lib/configure-map.js b/test/lib/configure-map.js index 2d0fa08..e13e61c 100644 --- a/test/lib/configure-map.js +++ b/test/lib/configure-map.js @@ -54,6 +54,10 @@ module.exports = function () { a(fn(), r, "Third"); a(i, 1, "Called once"); }, + "One arg": function (a) { + var fn = memoize(function (elo) { ++i; return arguments; }, { resolvers: [Boolean] }); + a.deep(aFrom(r = fn('elo')), [true], "First"); + }, "Some Args": function (a) { var x = {}; i = 0;