[Pkg-javascript-commits] [ltx] 394/469: use inherits npm module

Jonas Smedegaard dr at jones.dk
Wed Aug 31 13:03:30 UTC 2016


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository ltx.

commit 63f275b3336936a57177617306e97b9aaaecb751
Author: Sonny Piers <sonny at fastmail.net>
Date:   Thu Sep 10 03:49:52 2015 +0200

    use inherits npm module
---
 Gruntfile.js              | 4 ++--
 lib/Parser.js             | 2 +-
 lib/parsers/easysax.js    | 8 ++++----
 lib/parsers/ltx.js        | 8 ++++----
 lib/parsers/node-expat.js | 8 ++++----
 lib/parsers/node-xml.js   | 8 ++++----
 lib/parsers/sax.js        | 8 ++++----
 package.json              | 3 +++
 8 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index d840764..d788282 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -5,7 +5,7 @@ module.exports = function(grunt) {
     grunt.initConfig({
         pkg: grunt.file.readJSON('package.json'),
         jshint: {
-            allFiles: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'],
+            allFiles: ['*.js', 'lib/**/*.js', 'test/**/*.js'],
             options: {
                 jshintrc: '.jshintrc',
             }
@@ -20,7 +20,7 @@ module.exports = function(grunt) {
                 }
             }
         },
-        clean: ['ltx-browser.js'],
+        clean: ['ltx.js'],
         vows: {
             all: {
                 options: {
diff --git a/lib/Parser.js b/lib/Parser.js
index 0f03038..50029f9 100644
--- a/lib/Parser.js
+++ b/lib/Parser.js
@@ -1,7 +1,7 @@
 'use strict';
 
 var EventEmitter = require('events').EventEmitter
-var inherits = require('util').inherits
+var inherits = require('inherits')
 var Element = require('./Element')
 var LtxParser = require('./parsers/ltx')
 
diff --git a/lib/parsers/easysax.js b/lib/parsers/easysax.js
index 027bb61..c6c6440 100644
--- a/lib/parsers/easysax.js
+++ b/lib/parsers/easysax.js
@@ -1,18 +1,18 @@
 'use strict';
 
-var util = require('util')
-  , events = require('events')
+var inherits = require('inherits')
+  , EventEmitter = require('events').EventEmitter
   , Easysax = require('easysax')
 
 /**
  * FIXME: This SAX parser cannot be pushed to!
  */
 module.exports = SaxEasysax
-util.inherits(SaxEasysax, events.EventEmitter)
+inherits(SaxEasysax, EventEmitter)
 
 
 function SaxEasysax() {
-    events.EventEmitter.call(this)
+    EventEmitter.call(this)
     this.parser = new Easysax()
 
     var self = this
diff --git a/lib/parsers/ltx.js b/lib/parsers/ltx.js
index f6fc55d..8ba5a00 100644
--- a/lib/parsers/ltx.js
+++ b/lib/parsers/ltx.js
@@ -1,7 +1,7 @@
 'use strict';
 
-var util = require('util')
-  , events = require('events')
+var inherits = require('inherits')
+  , EventEmitter = require('events').EventEmitter
 
 var STATE_TEXT = 0,
     STATE_IGNORE_TAG = 1,
@@ -13,7 +13,7 @@ var STATE_TEXT = 0,
     STATE_ATTR_VALUE = 7
 
 var SaxLtx = module.exports = function SaxLtx() {
-    events.EventEmitter.call(this)
+    EventEmitter.call(this)
 
     var state = STATE_TEXT, remainder
     var tagName, attrs, endTag, selfClosing, attrQuote
@@ -147,7 +147,7 @@ var SaxLtx = module.exports = function SaxLtx() {
     origEmit.apply(this, arguments)
     }*/
 }
-util.inherits(SaxLtx, events.EventEmitter)
+inherits(SaxLtx, EventEmitter)
 
 
 SaxLtx.prototype.end = function(data) {
diff --git a/lib/parsers/node-expat.js b/lib/parsers/node-expat.js
index ca854e4..b5ac3b1 100644
--- a/lib/parsers/node-expat.js
+++ b/lib/parsers/node-expat.js
@@ -1,11 +1,11 @@
 'use strict';
 
-var util = require('util')
-  , events = require('events')
+var inherits = require('inherits')
+  , EventEmitter = require('events').EventEmitter
   , expat = require('node-expat')
 
 var SaxExpat = module.exports = function SaxExpat() {
-    events.EventEmitter.call(this)
+    EventEmitter.call(this)
     this.parser = new expat.Parser('UTF-8')
 
     var that = this
@@ -21,7 +21,7 @@ var SaxExpat = module.exports = function SaxExpat() {
     // TODO: other events, esp. entityDecl (billion laughs!)
 }
 
-util.inherits(SaxExpat, events.EventEmitter)
+inherits(SaxExpat, EventEmitter)
 
 SaxExpat.prototype.write = function(data) {
     if (!this.parser.parse(data, false)) {
diff --git a/lib/parsers/node-xml.js b/lib/parsers/node-xml.js
index 138ec4e..86b112b 100644
--- a/lib/parsers/node-xml.js
+++ b/lib/parsers/node-xml.js
@@ -1,7 +1,7 @@
 'use strict';
 
-var util = require('util')
-  , events = require('events')
+var inherits = require('inherits')
+  , EventEmitter = require('events').EventEmitter
   , xml = require('node-xml')
 
 /**
@@ -9,7 +9,7 @@ var util = require('util')
  * setTimeout(f, 0)
  */
 var SaxNodeXML = module.exports = function SaxNodeXML() {
-    events.EventEmitter.call(this)
+    EventEmitter.call(this)
     var self = this
     this.parser = new xml.SaxParser(function(handler) {
         /* jshint -W072 */
@@ -48,7 +48,7 @@ var SaxNodeXML = module.exports = function SaxNodeXML() {
     })
 }
 
-util.inherits(SaxNodeXML, events.EventEmitter)
+inherits(SaxNodeXML, EventEmitter)
 
 SaxNodeXML.prototype.write = function(data) {
     this.parser.parseString(data)
diff --git a/lib/parsers/sax.js b/lib/parsers/sax.js
index 4589e33..d96991c 100644
--- a/lib/parsers/sax.js
+++ b/lib/parsers/sax.js
@@ -1,12 +1,12 @@
 'use strict';
 
-var util = require('util')
-  , events = require('events')
+var inherits = require('inherits')
+  , EventEmitter = require('events').EventEmitter
   , sax = require('sax')
 
 var SaxSaxjs = module.exports = function SaxSaxjs() {
 
-    events.EventEmitter.call(this)
+    EventEmitter.call(this)
     this.parser = sax.parser(true)
 
     var that = this
@@ -28,7 +28,7 @@ var SaxSaxjs = module.exports = function SaxSaxjs() {
     // TODO: other events, esp. entityDecl (billion laughs!)
 }
 
-util.inherits(SaxSaxjs, events.EventEmitter)
+inherits(SaxSaxjs, EventEmitter)
 
 SaxSaxjs.prototype.write = function(data) {
     if (typeof data !== 'string') {
diff --git a/package.json b/package.json
index 462a3d6..ac55650 100644
--- a/package.json
+++ b/package.json
@@ -47,5 +47,8 @@
   },
   "scripts": {
     "test": "./node_modules/.bin/grunt test"
+  },
+  "dependencies": {
+    "inherits": "^2.0.1"
   }
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/ltx.git



More information about the Pkg-javascript-commits mailing list