Hello community,
here is the log from the commit of package nodejs-json-stringify-safe for openSUSE:Factory checked in at 2015-06-30 10:17:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nodejs-json-stringify-safe (Old)
and /work/SRC/openSUSE:Factory/.nodejs-json-stringify-safe.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nodejs-json-stringify-safe"
Changes:
--------
--- /work/SRC/openSUSE:Factory/nodejs-json-stringify-safe/nodejs-json-stringify-safe.changes 2015-04-27 13:01:33.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.nodejs-json-stringify-safe.new/nodejs-json-stringify-safe.changes 2015-06-30 10:17:39.000000000 +0200
@@ -1,0 +2,5 @@
+Sat Jun 27 05:28:13 UTC 2015 - i@marguerite.su
+
+- update version 5.0.1
+
+-------------------------------------------------------------------
Old:
----
json-stringify-safe-5.0.0.tgz
New:
----
json-stringify-safe-5.0.1.tgz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ nodejs-json-stringify-safe.spec ++++++
--- /var/tmp/diff_new_pack.B2uzQz/_old 2015-06-30 10:17:39.000000000 +0200
+++ /var/tmp/diff_new_pack.B2uzQz/_new 2015-06-30 10:17:39.000000000 +0200
@@ -19,7 +19,7 @@
%define base_name json-stringify-safe
Name: nodejs-json-stringify-safe
-Version: 5.0.0
+Version: 5.0.1
Release: 0
Summary: Like JSON.stringify, but doesn't throw on circular references
License: BSD-2-Clause
@@ -47,7 +47,7 @@
%files
%defattr(-,root,root,-)
-%doc README.md LICENSE
+%doc README.md LICENSE CHANGELOG.md
%{nodejs_modulesdir}/%{base_name}
%changelog
++++++ json-stringify-safe-5.0.0.tgz -> json-stringify-safe-5.0.1.tgz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/.npmignore new/package/.npmignore
--- old/package/.npmignore 1970-01-01 01:00:00.000000000 +0100
+++ new/package/.npmignore 2015-05-19 03:41:30.000000000 +0200
@@ -0,0 +1 @@
+/*.tgz
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/CHANGELOG.md new/package/CHANGELOG.md
--- old/package/CHANGELOG.md 1970-01-01 01:00:00.000000000 +0100
+++ new/package/CHANGELOG.md 2015-05-19 03:41:30.000000000 +0200
@@ -0,0 +1,14 @@
+## Unreleased
+- Fixes stringify to only take ancestors into account when checking
+ circularity.
+ It previously assumed every visited object was circular which led to [false
+ positives][issue9].
+ Uses the tiny serializer I wrote for [Must.js][must] a year and a half ago.
+- Fixes calling the `replacer` function in the proper context (`thisArg`).
+- Fixes calling the `cycleReplacer` function in the proper context (`thisArg`).
+- Speeds serializing by a factor of
+ Big-O(h-my-god-it-linearly-searched-every-object) it had ever seen. Searching
+ only the ancestors for a circular references speeds up things considerably.
+
+[must]: https://github.com/moll/js-must
+[issue9]: https://github.com/isaacs/json-stringify-safe/issues/9
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/LICENSE new/package/LICENSE
--- old/package/LICENSE 2013-02-19 20:00:08.000000000 +0100
+++ new/package/LICENSE 2015-05-19 03:41:59.000000000 +0200
@@ -1,27 +1,15 @@
-Copyright (c) Isaac Z. Schlueter ("Author")
-All rights reserved.
+The ISC License
-The BSD License
+Copyright (c) Isaac Z. Schlueter and Contributors
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
-BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/Makefile new/package/Makefile
--- old/package/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ new/package/Makefile 2015-05-19 03:41:30.000000000 +0200
@@ -0,0 +1,35 @@
+NODE_OPTS =
+TEST_OPTS =
+
+love:
+ @echo "Feel like makin' love."
+
+test:
+ @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R dot $(TEST_OPTS)
+
+spec:
+ @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R spec $(TEST_OPTS)
+
+autotest:
+ @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R dot --watch $(TEST_OPTS)
+
+autospec:
+ @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R spec --watch $(TEST_OPTS)
+
+pack:
+ @file=$$(npm pack); echo "$$file"; tar tf "$$file"
+
+publish:
+ npm publish
+
+tag:
+ git tag "v$$(node -e 'console.log(require("./package").version)')"
+
+clean:
+ rm -f *.tgz
+ npm prune --production
+
+.PHONY: love
+.PHONY: test spec autotest autospec
+.PHONY: pack publish tag
+.PHONY: clean
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/README.md new/package/README.md
--- old/package/README.md 2013-03-13 17:08:35.000000000 +0100
+++ new/package/README.md 2015-05-19 03:41:30.000000000 +0200
@@ -47,3 +47,6 @@
Returns a serializer that can be used elsewhere. This is the actual
function that's passed to JSON.stringify.
+
+**Note** that the function returned from `getSerialize` is stateful for now, so
+do **not** use it more than once.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/package.json new/package/package.json
--- old/package/package.json 2013-06-05 02:16:41.000000000 +0200
+++ new/package/package.json 2015-05-19 03:42:00.000000000 +0200
@@ -1,22 +1,31 @@
{
"name": "json-stringify-safe",
- "version": "5.0.0",
- "description": "Like JSON.stringify, but doesn't blow up on circular refs",
- "main": "stringify.js",
- "scripts": {
- "test": "node test.js"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/isaacs/json-stringify-safe"
- },
+ "version": "5.0.1",
+ "description": "Like JSON.stringify, but doesn't blow up on circular refs.",
"keywords": [
"json",
"stringify",
"circular",
"safe"
],
+ "homepage": "https://github.com/isaacs/json-stringify-safe",
+ "bugs": "https://github.com/isaacs/json-stringify-safe/issues",
"author": "Isaac Z. Schlueter (http://blog.izs.me)",
- "license": "BSD",
- "readmeFilename": "README.md"
+ "contributors": [
+ "Andri Möll (http://themoll.com)"
+ ],
+ "license": "ISC",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/json-stringify-safe"
+ },
+ "main": "stringify.js",
+ "scripts": {
+ "test": "node test.js"
+ },
+ "devDependencies": {
+ "mocha": ">= 2.1.0 < 3",
+ "must": ">= 0.12 < 0.13",
+ "sinon": ">= 1.12.2 < 2"
+ }
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/stringify.js new/package/stringify.js
--- old/package/stringify.js 2013-06-05 02:12:46.000000000 +0200
+++ new/package/stringify.js 2015-05-19 03:41:48.000000000 +0200
@@ -1,39 +1,27 @@
-module.exports = stringify;
+exports = module.exports = stringify
+exports.getSerialize = serializer
-function getSerialize (fn, decycle) {
- var seen = [], keys = [];
- decycle = decycle || function(key, value) {
- return '[Circular ' + getPath(value, seen, keys) + ']'
- };
- return function(key, value) {
- var ret = value;
- if (typeof value === 'object' && value) {
- if (seen.indexOf(value) !== -1)
- ret = decycle(key, value);
- else {
- seen.push(value);
- keys.push(key);
- }
- }
- if (fn) ret = fn(key, ret);
- return ret;
- }
+function stringify(obj, replacer, spaces, cycleReplacer) {
+ return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
}
-function getPath (value, seen, keys) {
- var index = seen.indexOf(value);
- var path = [ keys[index] ];
- for (index--; index >= 0; index--) {
- if (seen[index][ path[0] ] === value) {
- value = seen[index];
- path.unshift(keys[index]);
- }
+function serializer(replacer, cycleReplacer) {
+ var stack = [], keys = []
+
+ if (cycleReplacer == null) cycleReplacer = function(key, value) {
+ if (stack[0] === value) return "[Circular ~]"
+ return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"
}
- return '~' + path.join('.');
-}
-function stringify(obj, fn, spaces, decycle) {
- return JSON.stringify(obj, getSerialize(fn, decycle), spaces);
-}
+ 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)
-stringify.getSerialize = getSerialize;
+ return replacer == null ? value : replacer.call(this, key, value)
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/mocha.opts new/package/test/mocha.opts
--- old/package/test/mocha.opts 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/mocha.opts 2015-05-19 03:41:30.000000000 +0200
@@ -0,0 +1,2 @@
+--recursive
+--require must
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test/stringify_test.js new/package/test/stringify_test.js
--- old/package/test/stringify_test.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/stringify_test.js 2015-05-19 03:41:30.000000000 +0200
@@ -0,0 +1,246 @@
+var Sinon = require("sinon")
+var stringify = require("..")
+function jsonify(obj) { return JSON.stringify(obj, null, 2) }
+
+describe("Stringify", function() {
+ it("must stringify circular objects", function() {
+ var obj = {name: "Alice"}
+ obj.self = obj
+ var json = stringify(obj, null, 2)
+ json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"}))
+ })
+
+ it("must stringify circular objects with intermediaries", function() {
+ var obj = {name: "Alice"}
+ obj.identity = {self: obj}
+ var json = stringify(obj, null, 2)
+ json.must.eql(jsonify({name: "Alice", identity: {self: "[Circular ~]"}}))
+ })
+
+ it("must stringify circular objects deeper", function() {
+ var obj = {name: "Alice", child: {name: "Bob"}}
+ obj.child.self = obj.child
+
+ stringify(obj, null, 2).must.eql(jsonify({
+ name: "Alice",
+ child: {name: "Bob", self: "[Circular ~.child]"}
+ }))
+ })
+
+ it("must stringify circular objects deeper with intermediaries", function() {
+ var obj = {name: "Alice", child: {name: "Bob"}}
+ obj.child.identity = {self: obj.child}
+
+ stringify(obj, null, 2).must.eql(jsonify({
+ name: "Alice",
+ child: {name: "Bob", identity: {self: "[Circular ~.child]"}}
+ }))
+ })
+
+ it("must stringify circular objects in an array", function() {
+ var obj = {name: "Alice"}
+ obj.self = [obj, obj]
+
+ stringify(obj, null, 2).must.eql(jsonify({
+ name: "Alice", self: ["[Circular ~]", "[Circular ~]"]
+ }))
+ })
+
+ it("must stringify circular objects deeper in an array", function() {
+ var obj = {name: "Alice", children: [{name: "Bob"}, {name: "Eve"}]}
+ obj.children[0].self = obj.children[0]
+ obj.children[1].self = obj.children[1]
+
+ stringify(obj, null, 2).must.eql(jsonify({
+ name: "Alice",
+ children: [
+ {name: "Bob", self: "[Circular ~.children.0]"},
+ {name: "Eve", self: "[Circular ~.children.1]"}
+ ]
+ }))
+ })
+
+ it("must stringify circular arrays", function() {
+ var obj = []
+ obj.push(obj)
+ obj.push(obj)
+ var json = stringify(obj, null, 2)
+ json.must.eql(jsonify(["[Circular ~]", "[Circular ~]"]))
+ })
+
+ it("must stringify circular arrays with intermediaries", function() {
+ var obj = []
+ obj.push({name: "Alice", self: obj})
+ obj.push({name: "Bob", self: obj})
+
+ stringify(obj, null, 2).must.eql(jsonify([
+ {name: "Alice", self: "[Circular ~]"},
+ {name: "Bob", self: "[Circular ~]"}
+ ]))
+ })
+
+ it("must stringify repeated objects in objects", function() {
+ var obj = {}
+ var alice = {name: "Alice"}
+ obj.alice1 = alice
+ obj.alice2 = alice
+
+ stringify(obj, null, 2).must.eql(jsonify({
+ alice1: {name: "Alice"},
+ alice2: {name: "Alice"}
+ }))
+ })
+
+ it("must stringify repeated objects in arrays", function() {
+ var alice = {name: "Alice"}
+ var obj = [alice, alice]
+ var json = stringify(obj, null, 2)
+ json.must.eql(jsonify([{name: "Alice"}, {name: "Alice"}]))
+ })
+
+ it("must call given decycler and use its output", function() {
+ var obj = {}
+ obj.a = obj
+ obj.b = obj
+
+ var decycle = Sinon.spy(function() { return decycle.callCount })
+ var json = stringify(obj, null, 2, decycle)
+ json.must.eql(jsonify({a: 1, b: 2}, null, 2))
+
+ decycle.callCount.must.equal(2)
+ decycle.thisValues[0].must.equal(obj)
+ decycle.args[0][0].must.equal("a")
+ decycle.args[0][1].must.equal(obj)
+ decycle.thisValues[1].must.equal(obj)
+ decycle.args[1][0].must.equal("b")
+ decycle.args[1][1].must.equal(obj)
+ })
+
+ it("must call replacer and use its output", function() {
+ var obj = {name: "Alice", child: {name: "Bob"}}
+
+ var replacer = Sinon.spy(bangString)
+ var json = stringify(obj, replacer, 2)
+ json.must.eql(jsonify({name: "Alice!", child: {name: "Bob!"}}))
+
+ replacer.callCount.must.equal(4)
+ replacer.args[0][0].must.equal("")
+ replacer.args[0][1].must.equal(obj)
+ replacer.thisValues[1].must.equal(obj)
+ replacer.args[1][0].must.equal("name")
+ replacer.args[1][1].must.equal("Alice")
+ replacer.thisValues[2].must.equal(obj)
+ replacer.args[2][0].must.equal("child")
+ replacer.args[2][1].must.equal(obj.child)
+ replacer.thisValues[3].must.equal(obj.child)
+ replacer.args[3][0].must.equal("name")
+ replacer.args[3][1].must.equal("Bob")
+ })
+
+ it("must call replacer after describing circular references", function() {
+ var obj = {name: "Alice"}
+ obj.self = obj
+
+ var replacer = Sinon.spy(bangString)
+ var json = stringify(obj, replacer, 2)
+ json.must.eql(jsonify({name: "Alice!", self: "[Circular ~]!"}))
+
+ replacer.callCount.must.equal(3)
+ replacer.args[0][0].must.equal("")
+ replacer.args[0][1].must.equal(obj)
+ replacer.thisValues[1].must.equal(obj)
+ replacer.args[1][0].must.equal("name")
+ replacer.args[1][1].must.equal("Alice")
+ replacer.thisValues[2].must.equal(obj)
+ replacer.args[2][0].must.equal("self")
+ replacer.args[2][1].must.equal("[Circular ~]")
+ })
+
+ it("must call given decycler and use its output for nested objects",
+ function() {
+ var obj = {}
+ obj.a = obj
+ obj.b = {self: obj}
+
+ var decycle = Sinon.spy(function() { return decycle.callCount })
+ var json = stringify(obj, null, 2, decycle)
+ json.must.eql(jsonify({a: 1, b: {self: 2}}))
+
+ decycle.callCount.must.equal(2)
+ decycle.args[0][0].must.equal("a")
+ decycle.args[0][1].must.equal(obj)
+ decycle.args[1][0].must.equal("self")
+ decycle.args[1][1].must.equal(obj)
+ })
+
+ it("must use decycler's output when it returned null", function() {
+ var obj = {a: "b"}
+ obj.self = obj
+ obj.selves = [obj, obj]
+
+ function decycle() { return null }
+ stringify(obj, null, 2, decycle).must.eql(jsonify({
+ a: "b",
+ self: null,
+ selves: [null, null]
+ }))
+ })
+
+ it("must use decycler's output when it returned undefined", function() {
+ var obj = {a: "b"}
+ obj.self = obj
+ obj.selves = [obj, obj]
+
+ function decycle() {}
+ stringify(obj, null, 2, decycle).must.eql(jsonify({
+ a: "b",
+ selves: [null, null]
+ }))
+ })
+
+ it("must throw given a decycler that returns a cycle", function() {
+ var obj = {}
+ obj.self = obj
+ var err
+ function identity(key, value) { return value }
+ try { stringify(obj, null, 2, identity) } catch (ex) { err = ex }
+ err.must.be.an.instanceof(TypeError)
+ })
+
+ describe(".getSerialize", function() {
+ it("must stringify circular objects", function() {
+ var obj = {a: "b"}
+ obj.circularRef = obj
+ obj.list = [obj, obj]
+
+ var json = JSON.stringify(obj, stringify.getSerialize(), 2)
+ json.must.eql(jsonify({
+ "a": "b",
+ "circularRef": "[Circular ~]",
+ "list": ["[Circular ~]", "[Circular ~]"]
+ }))
+ })
+
+ // This is the behavior as of Mar 3, 2015.
+ // The serializer function keeps state inside the returned function and
+ // so far I'm not sure how to not do that. JSON.stringify's replacer is not
+ // called _after_ serialization.
+ xit("must return a function that could be called twice", function() {
+ var obj = {name: "Alice"}
+ obj.self = obj
+
+ var json
+ var serializer = stringify.getSerialize()
+
+ json = JSON.stringify(obj, serializer, 2)
+ json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"}))
+
+ json = JSON.stringify(obj, serializer, 2)
+ json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"}))
+ })
+ })
+})
+
+function bangString(key, value) {
+ return typeof value == "string" ? value + "!" : value
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test.js new/package/test.js
--- old/package/test.js 2013-06-05 02:16:03.000000000 +0200
+++ new/package/test.js 1970-01-01 01:00:00.000000000 +0100
@@ -1,128 +0,0 @@
-var stringify = require('./stringify.js');
-
-var circularObj = { a: 'b' };
-circularObj.circularRef = circularObj;
-circularObj.list = [ circularObj, circularObj ];
-
-//////////
-// default
-var testObj = {
- "a": "b",
- "circularRef": "[Circular ~]",
- "list": [
- "[Circular ~]",
- "[Circular ~]"
- ]
-};
-
-var assert = require('assert');
-assert.equal(JSON.stringify(testObj, null, 2),
- stringify(circularObj, null, 2));
-
-assert.equal(JSON.stringify(testObj, null, 2),
- JSON.stringify(circularObj, stringify.getSerialize(), 2));
-
-
-////////
-// prune
-testObj = {
- "a": "b",
- "list": [
- null,
- null
- ]
-};
-
-function prune(k, v) {}
-
-assert.equal(JSON.stringify(testObj, null, 2),
- stringify(circularObj, null, 2, prune));
-
-///////////
-// re-cycle
-// (throws)
-function recycle(k, v) {
- return v;
-}
-
-assert.throws(function() {
- stringify(circularObj, null, 2, recycle);
-});
-
-////////
-// fancy
-testObj = {
- "a": "b",
- "circularRef": "circularRef{a:string,circularRef:Object,list:Array}",
- "list": [
- "0{a:string,circularRef:Object,list:Array}",
- "1{a:string,circularRef:Object,list:Array}"
- ]
-};
-
-function signer(key, value) {
- var ret = key + '{';
- var f = false;
- for (var i in value) {
- if (f)
- ret += ',';
- f = true;
- ret += i + ':';
- var v = value[i];
- switch (typeof v) {
- case 'object':
- if (!v)
- ret += 'null';
- else if (Array.isArray(v))
- ret += 'Array'
- else
- ret += v.constructor && v.constructor.name || 'Object';
- break;
- default:
- ret += typeof v;
- break;
- }
- }
- ret += '}';
- return ret;
-}
-
-assert.equal(JSON.stringify(testObj, null, 2),
- stringify(circularObj, null, 2, signer));
-
-
-///////
-//multi
-var a = { x: 1 };
-a.a = a;
-var b = { x: 2 };
-b.a = a;
-
-var c = { a: a, b: b };
-var d = { list: [ a, b, c ] };
-d.d = d;
-
-var multi = {
- "list": [
- {
- "x": 1,
- "a": "[Circular ~.list.0]"
- },
- {
- "x": 2,
- "a": "[Circular ~.list.0]"
- },
- {
- "a": "[Circular ~.list.0]",
- "b": "[Circular ~.list.1]"
- }
- ],
- "d": "[Circular ~]"
-};
-
-assert.equal(JSON.stringify(multi, null, 2),
- stringify(d, null, 2));
-
-////////
-// pass!
-console.log('ok');