From 583455239a62394297ccc8fca4a5fbc685359b64 Mon Sep 17 00:00:00 2001 From: Farrin Reid Date: Sat, 23 Jun 2012 05:56:11 -0800 Subject: [PATCH] [fix] Changed require('sys') to require('util') for compatibility with node v0.8 --- snippet.js | 6 +++--- utils_example.js | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/snippet.js b/snippet.js index 9448ea3..5b7315c 100644 --- a/snippet.js +++ b/snippet.js @@ -1,15 +1,15 @@ //node --prof --prof_auto profile.js //deps/v8/tools/mac-tick-processor v8.log -var sys = require("sys"); +var util = require('util'); var htmlparser = require("./htmlparser"); var html = "text"; var handler = new htmlparser.DefaultHandler(function(err, dom) { if (err) - sys.debug("Error: " + err); + util.debug("Error: " + err); else - sys.debug(sys.inspect(dom, false, null)); + util.debug(util.inspect(dom, false, null)); }, { enforceEmptyTags: true }); var parser = new htmlparser.Parser(handler); parser.parseComplete(html); diff --git a/utils_example.js b/utils_example.js index d219de5..bc18544 100644 --- a/utils_example.js +++ b/utils_example.js @@ -1,34 +1,34 @@ //node --prof --prof_auto profile.js //deps/v8/tools/mac-tick-processor v8.log -var sys = require("sys"); +var util = require('util'); var htmlparser = require("./lib/htmlparser"); var html = "text atext btext ctext ehhhhellowworld"; var handler = new htmlparser.DefaultHandler(function(err, dom) { if (err) { - sys.debug("Error: " + err); + util.debug("Error: " + err); } else { - sys.debug(sys.inspect(dom, false, null)); + util.debug(util.inspect(dom, false, null)); var id = htmlparser.DomUtils.getElementById("x", dom); - sys.debug("id: " + sys.inspect(id, false, null)); + util.debug("id: " + util.inspect(id, false, null)); var class = htmlparser.DomUtils.getElements({ class: "y" }, dom); - sys.debug("class: " + sys.inspect(class, false, null)); + util.debug("class: " + util.inspect(class, false, null)); var multiclass = htmlparser.DomUtils.getElements({ class: function (value) { return(value && value.indexOf("h") > -1); } }, dom); - sys.debug("multiclass: " + sys.inspect(multiclass, false, null)); + util.debug("multiclass: " + util.inspect(multiclass, false, null)); var name = htmlparser.DomUtils.getElementsByTagName("a", dom); - sys.debug("name: " + sys.inspect(name, false, null)); + util.debug("name: " + util.inspect(name, false, null)); var text = htmlparser.DomUtils.getElementsByTagType("text", dom); - sys.debug("text: " + sys.inspect(text, false, null)); + util.debug("text: " + util.inspect(text, false, null)); var nested = htmlparser.DomUtils.getElements({ tag_name: "d", id: "z", class: "w" }, dom); nested = htmlparser.DomUtils.getElementsByTagName("e", nested); nested = htmlparser.DomUtils.getElementsByTagType("text", nested); - sys.debug("nested: " + sys.inspect(nested, false, null)); + util.debug("nested: " + util.inspect(nested, false, null)); var double = htmlparser.DomUtils.getElementsByTagName("yy", dom); - sys.debug("double: " + sys.inspect(double, false, null)); + util.debug("double: " + util.inspect(double, false, null)); var single = htmlparser.DomUtils.getElements( { tag_name: "yy", id: "secondyy" }, dom); - sys.debug("single: " + sys.inspect(single, false, null)); + util.debug("single: " + util.inspect(single, false, null)); } }, { verbose: false }); var parser = new htmlparser.Parser(handler);