This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = Foo; | |
| //now i would like to have a constructor function for the foo "class" (i know in JS that does not exist) | |
| //with normal js this would be | |
| function Foo(arg1,arg2){ | |
| this.something = arg1; | |
| this.somethingOther = arg2; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/stream.js b/lib/stream.js | |
| index 189708a..37687b0 100644 | |
| --- a/lib/stream.js | |
| +++ b/lib/stream.js | |
| @@ -53,3 +53,22 @@ Stream.prototype.pipe = function (dest, options) { | |
| if (source.readable) source.resume(); | |
| }); | |
| }; | |
| + | |
| +exports.createFilter = function (listener) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/module.js b/lib/module.js | |
| index 72814a7..1db1cb4 100644 | |
| --- a/lib/module.js | |
| +++ b/lib/module.js | |
| @@ -83,17 +83,6 @@ var pathFn = process.compile("(function (exports) {" + natives.path + "\n})", | |
| var pathModule = createInternalModule('path', pathFn); | |
| var path = pathModule.exports; | |
| -function existsSync (path) { | |
| - try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/module.js b/lib/module.js | |
| index 72814a7..0827d13 100644 | |
| --- a/lib/module.js | |
| +++ b/lib/module.js | |
| @@ -83,17 +83,6 @@ var pathFn = process.compile("(function (exports) {" + natives.path + "\n})", | |
| var pathModule = createInternalModule('path', pathFn); | |
| var path = pathModule.exports; | |
| -function existsSync (path) { | |
| - try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fromAll("foo","bar","baz","widget", function(foo, bar, baz, widget){ | |
| var myThing | |
| // Actual library code | |
| return myThing | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var HTTPParser = process.binding('http_parser').HTTPParser; | |
| var net = require('net'); | |
| var path = require('path'); | |
| var sys = require('sys'); | |
| var Worker = require('webworker').Worker; | |
| var VHOSTS = ['foo.bar.com', 'baz.bizzle.com']; | |
| var WORKERS = {}; | |
| VHOSTS.forEach(function(vh) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var crypto = require('crypto'); | |
| ["sha1", "md5", "sha256", "sha512", "ripemd160"].forEach(function(algo) { | |
| exports[algo] = function(data, salt) { | |
| return crypto["createH"+(typeof salt != 'undefined' ? "mac":"ash"](algo,salt) | |
| .update(data).digest("hex"); | |
| }; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var sys = require('sys'), | |
| crypto = require('crypto'), | |
| algos = ["sha1", "md5", "sha256", "sha512", "ripemd160"], | |
| encoding = "hex"; | |
| algos.forEach( function( algo) { | |
| exports[ algo ] = function(data, salt) { | |
| return (typeof salt === 'undefined') | |
| ? crypto.createHash(algo).update(data).digest(encoding) | |
| : crypto.createHmac(algo, salt).update(data).digest(encoding) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function readAllHelps (cb) { | |
| var help_text = [] | |
| , didError = false | |
| function error (er) { | |
| if (didError) return undefined | |
| didError = true | |
| cb(er) | |
| } | |
| fs.readdir('help', function(er, files) { | |
| if (err) return error(er) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var n = 45 | |
| , sys = require("sys") | |
| sys.puts(typeof n); // number | |
| sys.puts(n instanceof Number); // false | |
| var m = Number(45); | |
| sys.puts(typeof m); // number |