Update to latest jsonld.js.
authorDave Longley <dlongley@digitalbazaar.com>
Wed, 11 Jan 2012 22:13:11 -0500
changeset 337 d2830bafe684
parent 336 1af76c4b7fe6
child 338 f206ab6e2a0d
Update to latest jsonld.js.
playground/jsonld.js
--- a/playground/jsonld.js	Wed Jan 11 21:53:12 2012 -0500
+++ b/playground/jsonld.js	Wed Jan 11 22:13:11 2012 -0500
@@ -500,7 +500,7 @@
          rval = {'@context': ctxOut};
          if(out.constructor === Array)
          {
-            rval['@id'] = out;
+            rval[_getKeywords(ctxOut)['@id']] = out;
          }
          else
          {
@@ -3066,36 +3066,6 @@
       {
          rval = jsonld.compact(ctx, rval);
       }
-/*      
-      // preserve top-level array
-      if(isArray && rval.constructor !== Array)
-      {
-         ctx = rval['@context'];
-         var idKeyword = '@id';
-         for(var key in ctx)
-         {
-            if(ctx[key] === '@id')
-            {
-               idKeyword = key;
-            }
-         }
-         var arr = rval['@id'];
-         rval = [];
-         for(var i in arr)
-         {
-            // make '@context' first key
-            var value = {
-               '@context': ctx,
-            };
-            var keys = Object.keys(arr[i]);
-            for(var k in keys)
-            {
-               var key = keys[k];
-               value[key] = arr[i][key];
-            }
-            rval.push(value);
-         }
-      }*/
    }
    
    return rval;