deploy1 %!s(int64=6) %!d(string=hai) anos
pai
achega
78b069a131
Modificáronse 1 ficheiros con 15 adicións e 5 borrados
  1. 15 5
      predictable_random.js

+ 15 - 5
predictable_random.js

@@ -1,6 +1,6 @@
-
 module.exports = function nailfactory(boot) {
-	var BOOT = boot || 0xbadebabe;
+    var BOOT = boot || 0xbadebabe;
+
 
     function stringify(obj, replacer, spaces, cycleReplacer) {
         return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
@@ -17,10 +17,19 @@ module.exports = function nailfactory(boot) {
 
         return function(key, value) {
             if (stack.length > 0) {
-                var thisPos = stack.indexOf(this)~ thisPos ? stack.splice(thisPos + 1) : stack.push(this)~ thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
-                if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value)
-            } else stack.push(value)
+                var thisPos = stack.indexOf(this);
+
+                (~thisPos) ? stack.splice(thisPos + 1) : stack.push(this);
+
+                (~thisPos) ? keys.splice(thisPos, Infinity, key) : keys.push(key);
 
+                if (~stack.indexOf(value)) {
+                    value = cycleReplacer.call(this, key, value)
+                }
+            } else {
+                stack.push(value)
+
+            }
             return replacer == null ? value : replacer.call(this, key, value)
         }
     }
@@ -28,6 +37,7 @@ module.exports = function nailfactory(boot) {
 
 
     var Mash = function() {
+        //	var n = 0xefc8249d;
         var n = BOOT;
 
         var mash = function(data) {