I've been studying this method and its usage, and I think I can now propose a simplification that will make it easier to understand. What do you think of:

```diff
-Utils.singleton = function(constructor, fn) {
+Utils.singleton = function(constructor, getKey) {
   var singletonMap = new Map();
-  if (!fn) {
-    fn = function(map, args) {
+  if (!getKey) {
+    getKey = function() {
       // default: ignore arguments, just key on constructor object
-      return [constructor, map.get(constructor)];
+      return constructor;
     };
   }
   return function() {
     var argl = Array.prototype.slice.call(arguments);
-    var mem = fn(singletonMap, argl);
-    var key = mem[0];
-    var val = mem[1];
-    if (!val) {
-      val = Object.create(constructor.prototype);
-      constructor.apply(val, argl);
-      singletonMap.set(key, val);
+    var key = getKey.apply(null, argl);
+    var instance = singletonMap.get(key);
+    if (!instance) {
+      instance = Object.create(constructor.prototype);
+      constructor.apply(instance, argl);
+      singletonMap.set(key, instance);
     }
-    return val;
+    return instance;
   };
 };
 ```

Since consumers don't have to interact with the `singletonMap`, this makes the function easier to read and to use. The usage will have to be modified in `database.js`:

```diff
@@ -169,8 +169,8 @@ define(function(require, exports) {
 
   var databaseSingletons = new Map();
 
-  Database.singleton = Utils.singleton(Database, function(map, args) {
-    return [args[0].name, map.get(args[0].name)];
+  Database.singleton = Utils.singleton(Database, function(opts) {
+    return opts.name;
   });
```

And here I'll allow for the possibility that I've overlooked something very important.