[Pkg-javascript-commits] [node-expat] 332/371: Some cleanup
Jonas Smedegaard
dr at jones.dk
Sun Feb 28 10:00:29 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository node-expat.
commit 96f7beef1303028059fc62542e0ea0b8fe31d34d
Author: Sonny Piers <sonny at fastmail.net>
Date: Wed Aug 5 12:51:25 2015 +0200
Some cleanup
---
.travis.yml | 16 ++++++++--------
README.markdown => README.md | 6 +++---
bench.js | 16 +++++++++-------
lib/node-expat.js | 5 +++--
node-expat.cc | 18 +++++++++---------
package.json | 26 ++++++++++----------------
test/index.js | 2 ++
7 files changed, 44 insertions(+), 45 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 84cadbf..8e845b8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,13 +1,13 @@
+sudo: false
+
language: node_js
+
node_js:
- - 0.8
+ - "0.8"
- "0.10"
- "0.12"
- - iojs
-before_install:
- # Workaround for a permissions issue with Travis virtual machine images
- # that breaks Python's multiprocessing:
- # https://github.com/travis-ci/travis-cookbooks/issues/155
- - sudo rm -rf /dev/shm
- - sudo ln -s /run/shm /dev/shm
+ - "iojs-v2.5.0"
+before_install:
+ # npm shipped with Node.js 0.8 doesn't support carret so let's update it
+ - if [ "$TRAVIS_NODE_VERSION" == "0.8" ]; then npm install -g npm; fi
diff --git a/README.markdown b/README.md
similarity index 91%
rename from README.markdown
rename to README.md
index 130f78d..61400b3 100644
--- a/README.markdown
+++ b/README.md
@@ -1,8 +1,8 @@
-# node-expat
+# node-expat
[![Build Status](https://travis-ci.org/node-xmpp/node-expat.png)](https://travis-ci.org/node-xmpp/node-expat)
-## Motivation
+## Motivation
You use [node.js](http://github.com/ry/node) for speed? You process
XML streams? Then you want the fastest XML parser: [libexpat](http://expat.sourceforge.net/)!
@@ -11,7 +11,7 @@ XML streams? Then you want the fastest XML parser: [libexpat](http://expat.sourc
Please see the [node-expat manual](http://node-xmpp.org/doc/expat.html)
-## Install
+## Install
Install node-expat:
diff --git a/bench.js b/bench.js
index c7e74a9..14825a8 100644
--- a/bench.js
+++ b/bench.js
@@ -1,7 +1,9 @@
+'use strict';
+
var util = require('util');
var node_xml = require("node-xml");
var libxml = require("libxmljs");
-var expat = require('node-expat');
+var expat = require('./');
var sax = require('sax');
function NodeXmlParser() {
@@ -29,9 +31,9 @@ function ExpatParser() {
};
}
-//var p = new NodeXmlParser();
-//var p = new LibXmlJsParser();
-//var p = new SaxParser();
+// var p = new NodeXmlParser();
+// var p = new LibXmlJsParser();
+// var p = new SaxParser();
var p = new ExpatParser();
p.parse("<r>");
var nEl = 0;
@@ -44,7 +46,7 @@ d();
var its =[];
setInterval(function() {
- util.puts(nEl + " el/s");
+ console.log(nEl + " el/s");
its.push(nEl);
nEl = 0;
}, 1000);
@@ -55,6 +57,6 @@ process.on('SIGINT', function () {
average += v;
});
average /= its.length;
- util.puts("Average: " + average + " el/s");
+ console.log("Average: " + average + " el/s");
process.exit(0);
-});
\ No newline at end of file
+});
diff --git a/lib/node-expat.js b/lib/node-expat.js
index 597a047..078c62f 100644
--- a/lib/node-expat.js
+++ b/lib/node-expat.js
@@ -1,6 +1,7 @@
+'use strict'
+
var EventEmitter = require('events').EventEmitter
var util = require('util')
-// Only support nodejs v0.6 and on so no need to look for older module location
var expat = require('bindings')('node_expat')
var Stream = require('stream').Stream
@@ -109,4 +110,4 @@ exports.createParser = function(cb) {
parser.on('startElement', cb)
}
return parser
-}
\ No newline at end of file
+}
diff --git a/node-expat.cc b/node-expat.cc
index 0728e0a..75b412e 100644
--- a/node-expat.cc
+++ b/node-expat.cc
@@ -76,7 +76,7 @@ protected:
XML_SetEntityDeclHandler(parser, EntityDecl);
XML_SetUnknownEncodingHandler(parser, UnknownEncoding, this);
}
-
+
/*** parse() ***/
static NAN_METHOD(Parse)
@@ -174,7 +174,7 @@ protected:
else
NanReturnValue(NanNull());
}
-
+
/*** stop() ***/
static NAN_METHOD(Stop)
@@ -183,7 +183,7 @@ protected:
Parser *parser = ObjectWrap::Unwrap<Parser>(args.This());
int status = parser->stop();
-
+
NanReturnValue(status ? NanTrue() : NanFalse());
}
@@ -191,7 +191,7 @@ protected:
{
return XML_StopParser(parser, XML_TRUE) != 0;
}
-
+
/*** resume() ***/
static NAN_METHOD(Resume)
@@ -200,7 +200,7 @@ protected:
Parser *parser = ObjectWrap::Unwrap<Parser>(args.This());
int status = parser->resume();
-
+
NanReturnValue(status ? NanTrue() : NanFalse());
}
@@ -208,7 +208,7 @@ protected:
{
return XML_ResumeParser(parser) != 0;
}
-
+
static NAN_METHOD(Reset)
{
NanScope();
@@ -224,7 +224,7 @@ protected:
int status = parser->reset(encoding);
if (encoding)
delete[] encoding;
- if (status)
+ if (status)
parser->attachHandlers();
NanReturnValue(status ? NanTrue() : NanFalse());
}
@@ -285,7 +285,7 @@ private:
/* no default ctor */
Parser();
-
+
/*** SAX callbacks ***/
/* Should a local HandleScope be used in those callbacks? */
@@ -317,7 +317,7 @@ private:
Handle<Value> argv[2] = { NanNew("endElement"), NanNew(name) };
parser->Emit(2, argv);
}
-
+
static void StartCdata(void *userData)
{
NanScope();
diff --git a/package.json b/package.json
index 79ded06..d43905b 100644
--- a/package.json
+++ b/package.json
@@ -15,19 +15,16 @@
"test": "vows --spec ./test/**/*.js"
},
"dependencies": {
- "bindings": "~1.2.1",
- "debug": "~2.2.0",
- "iconv": "~2.1.5",
- "nan": "~1.8.4"
+ "bindings": "^1.2.1",
+ "debug": "^2.2.0",
+ "iconv": "^2.1.5",
+ "nan": "^1.8.4"
},
"devDependencies": {
- "vows": ">=0.5.12"
+ "vows": "^0.8.1"
},
- "repository": {
- "type": "git",
- "url": "https://github.com/node-xmpp/node-expat.git"
- },
- "homepage": "http://node-xmpp.github.io/doc/nodeexpat.html",
+ "repository": "github:node-xmpp/node-expat",
+ "homepage": "http://github.com/node-xmpp/node-expat",
"bugs": "https://github.com/node-xmpp/node-expat/issues",
"author": {
"name": "Astro",
@@ -54,13 +51,10 @@
"Andreas Botsikas",
"Tom Hughes-Croucher",
"Nathan Rajlich",
- "Julien Genestoux"
- ],
- "licenses": [
- {
- "type": "MIT"
- }
+ "Julien Genestoux",
+ "Sonny Piers"
],
+ "license": "MIT",
"engines": {
"node": ">=0.8"
}
diff --git a/test/index.js b/test/index.js
index f65e421..0cb3357 100644
--- a/test/index.js
+++ b/test/index.js
@@ -1,3 +1,5 @@
+'use strict';
+
var expat = require('../lib/node-expat')
, Iconv = require('iconv').Iconv
, Buffer = require('buffer').Buffer
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-expat.git
More information about the Pkg-javascript-commits
mailing list