diff options
author | Paul Joseph Davis <davisp@apache.org> | 2011-09-28 01:14:56 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2011-09-28 01:14:56 +0000 |
commit | 86f113f9a0f3fdca02dfada0fa9854923b133a67 (patch) | |
tree | 60610e37fbb32d6142812a393848c05bdd7e6617 | |
parent | 61f10e7590bd352b367ad426a56587cbef3700b6 (diff) |
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
-rw-r--r-- | share/server/util.js | 2 |
1 files changed, 1 insertions, 1 deletions
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, { |