From 10d3bf52ba71c6d52bac086f0ce1fce8c39a56bf Mon Sep 17 00:00:00 2001 From: Victor Castell Date: Mon, 7 Feb 2011 12:42:09 +0100 Subject: [PATCH] Rename example files and documentation --- README | 10 ---------- README.md | 18 ++++++++++++++++++ test.html => browser-example.html | 0 tests.js => node-example.js | 9 ++++++--- tuna.js | 9 +++++++++ 5 files changed, 33 insertions(+), 13 deletions(-) delete mode 100644 README create mode 100644 README.md rename test.html => browser-example.html (100%) rename tests.js => node-example.js (73%) diff --git a/README b/README deleted file mode 100644 index db27b96..0000000 --- a/README +++ /dev/null @@ -1,10 +0,0 @@ -Tuna is a tool to inspect JavaScript objects. It is a tool to digg in the details of JavaScript object instances that tries to define an standard way to visualize the object hierarchy. - -The motivation for writing this library is to extend the core JavaScript object inspection capabilities and define a standard way of looking in to instances inspired by AS3 describeType() function. Contrary to describeType instead of returning XML object definition it is based on JavaScript objects or JSON objects. - -Use ----------------- - -Include the main script in your page or require it in your Node script and use -Tuna.describe(object); - diff --git a/README.md b/README.md new file mode 100644 index 0000000..fa84fa0 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +Tuna - Common sense JavaScript object introspection +=== + +Tuna is a tool to inspect JavaScript objects. It is a tool to digg in the details of JS object instances that tries to define a standard way to visualize the object hierarchy. + +The motivation for writing this library is to extend the core JavaScript object inspection capabilities and define a standard way of looking in to instances inspired by AS3 describeType() function and by node.js sys.inspect. Contrary to describeType instead of returning XML object definition it is based on JavaScript objects or JSON objects. + +It's similar in many aspects to node's sys.inspect but the output format is a bit different and it's usable outside this environment and inside too. + +Use +--- + +Include the main script in your page or require it in your Node script and use + + Tuna.describe(object); + +Copyright(c) 2011 Victor Castell victorcoder at gmail.com + diff --git a/test.html b/browser-example.html similarity index 100% rename from test.html rename to browser-example.html diff --git a/tests.js b/node-example.js similarity index 73% rename from tests.js rename to node-example.js index 192f5d4..4fee0d6 100644 --- a/tests.js +++ b/node-example.js @@ -1,3 +1,8 @@ +require.paths.unshift('.'); +var sys = require("sys"); + +var Tuna = require("tuna").Tuna; + //Samples var foo = { "bar": "foobar", @@ -19,6 +24,4 @@ var foo = { } }; -function algo(param1) {} - -console.log(Tuna.describe(foo)); \ No newline at end of file +console.log(Tuna.describe(foo), true, null); \ No newline at end of file diff --git a/tuna.js b/tuna.js index a3b5a38..13a313c 100644 --- a/tuna.js +++ b/tuna.js @@ -19,6 +19,9 @@ You can use the other methods but they are not of much utility outside the scope of the class. + + Some code borrowed from: + https://github.com/ry/node/blob/master/lib/util.js */ // Wrap in a closure for hiding methods and avoid global variables. @@ -99,3 +102,9 @@ var Tuna = (function() { } } })(); + +try { + exports.Tuna = Tuna; +} catch(error) { + +} \ No newline at end of file