From 86f113f9a0f3fdca02dfada0fa9854923b133a67 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Wed, 28 Sep 2011 01:14:56 +0000 Subject: Allow CommonJS modules to be an empty string. We were making a typical JavaScript mistake testing a module for truthiness instead of checking that it was undefined. Fixes COUCHDB-1223 Backport of r1176677 from trunk git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1176679 13f79535-47bb-0310-9956-ffa450edef68 --- share/server/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share/server') diff --git a/share/server/util.js b/share/server/util.js index 6afb38b6..f6fa60bb 100644 --- a/share/server/util.js +++ b/share/server/util.js @@ -46,7 +46,7 @@ var resolveModule = function(names, mod, root) { } else if (root) { mod = {current : root}; } - if (!mod.current[n]) { + if (mod.current[n] === undefined) { throw ["error", "invalid_require_path", 'Object has no property "'+n+'". '+JSON.stringify(mod.current)]; } return resolveModule(names, { -- cgit v1.2.3