Skip to content

Commit 02cfafd

Browse files
committed
Inline pathize.
1 parent 64f6e9c commit 02cfafd

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

stringify.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ function serializer(replacer, cycleReplacer) {
99
var stack = [], keys = []
1010

1111
if (cycleReplacer == null) cycleReplacer = function(key, value) {
12-
return pathize(stack, keys, value)
12+
if (stack[0] === value) return "[Circular ~]"
13+
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"
1314
}
1415

1516
return function(key, value) {
@@ -24,8 +25,3 @@ function serializer(replacer, cycleReplacer) {
2425
return replacer == null ? value : replacer.call(this, key, value)
2526
}
2627
}
27-
28-
function pathize(stack, keys, value) {
29-
if (stack[0] === value) return "[Circular ~]"
30-
return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"
31-
}

0 commit comments

Comments
 (0)