Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Minor Node 0.6 upgrades #1

Merged
merged 3 commits into from

2 participants

@jhs
jhs commented

Hi! I'm get a crash when running the examples in Node v0.6. This is because regular expression objects have changed a bit since 0.4. This request has the fix for that.

I also corrected a warning about the sys module, and changed the package metadata slightly to be a little more explicit.

If you like the changes, would you please merge and bump the version and npm publish? Thanks!

jhs added some commits
@jhs jhs Change the deprecated "sys" module to "util" f8a5268
@jhs jhs Support the different RegEx type in Node 0.6
In Node.js 0.6, `typeof /foo/` returns "function", but
`foo instanceof RegExp` returns `true`. So this change works for both
versions.
00a07b6
@jhs jhs Explicitly indicate Node.js 0.4.*, 0.5.*, and 0.6.* support 0670c2a
@Floby
Owner

Looks good to me. Thank you very much =)

@Floby Floby merged commit 76f2a70 into Floby:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 6, 2011
  1. @jhs
  2. @jhs

    Support the different RegEx type in Node 0.6

    jhs authored
    In Node.js 0.6, `typeof /foo/` returns "function", but
    `foo instanceof RegExp` returns `true`. So this change works for both
    versions.
  3. @jhs
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 5 deletions.
  1. +3 −4 lib/Tokenizer.js
  2. +1 −1  package.json
View
7 lib/Tokenizer.js
@@ -1,5 +1,5 @@
var EventEmitter = require('events').EventEmitter;
-var sys = require('sys');
+var util = require('util');
var assert = require('assert');
function noop(){}
@@ -13,7 +13,7 @@ function Tokenizer (check_token_cb) {
// these will be parsed but not emitted
this._checkToken = check_token_cb || noop;
}
-sys.inherits(Tokenizer, EventEmitter);
+util.inherits(Tokenizer, EventEmitter);
Tokenizer.prototype.write = function write(data, nobuffer) {
assert.ok(typeof data == 'string');
@@ -89,8 +89,7 @@ Tokenizer.prototype.addRule = function addRule(regex, type) {
if(!type) {
return this.addRule(regex[0], regex[1]);
}
- assert.equal(typeof regex, 'function');
- //assert.ok(regex instanceof RegExp);
+ assert.ok((regex instanceof RegExp) || (typeof regex === 'function'))
assert.equal(typeof type, 'string');
this._regexes.push({regex:regex,type:type});
};
View
2  package.json
@@ -13,6 +13,6 @@
"lib": "lib"
},
"engines": {
- "node": "*"
+ "node": "~0.4 ~0.5 ~0.6"
}
}
Something went wrong with that request. Please try again.