Commit cac1c6b0 authored by Leo Iannacone's avatar Leo Iannacone

update internals libraries

parent 5f5e1a3a
...@@ -48,9 +48,5 @@ ...@@ -48,9 +48,5 @@
"readme": " {\n } } {\n { { } }\n } }{ {\n { }{ } } _____ __ __\n { }{ }{ { } / ____| / _|/ _|\n .- { { } { }} -. | | ___ | |_| |_ ___ ___\n ( { } { } { } } ) | | / _ \\| _| _/ _ \\/ _ \\\n |`-..________ ..-'| | |___| (_) | | | || __/ __/\n | | \\_____\\___/|_| |_| \\___|\\___|\n | ;--.\n | (__ \\ _____ _ _\n | | ) ) / ____| (_) | |\n | |/ / | (___ ___ _ __ _ _ __ | |_\n | ( / \\___ \\ / __| '__| | '_ \\| __|\n | |/ ____) | (__| | | | |_) | |_\n | | |_____/ \\___|_| |_| .__/ \\__|\n `-.._________..-' | |\n |_|\n\n\n CoffeeScript is a little language that compiles into JavaScript.\n\n If you have the Node Package Manager installed:\n npm install -g coffee-script\n (Leave off the -g if you don't wish to install globally.)\n\n Or, if you don't wish to use npm:\n sudo bin/cake install\n\n Execute a script:\n coffee /path/to/script.coffee\n\n Compile a script:\n coffee -c /path/to/script.coffee\n\n For documentation, usage, and examples, see:\n http://coffeescript.org/\n\n To suggest a feature, report a bug, or general discussion:\n http://github.com/jashkenas/coffeescript/issues/\n\n If you'd like to chat, drop by #coffeescript on Freenode IRC,\n or on webchat.freenode.net.\n\n The source repository:\n git://github.com/jashkenas/coffeescript.git\n\n Top 100 contributors are listed here:\n http://github.com/jashkenas/coffeescript/contributors\n", "readme": " {\n } } {\n { { } }\n } }{ {\n { }{ } } _____ __ __\n { }{ }{ { } / ____| / _|/ _|\n .- { { } { }} -. | | ___ | |_| |_ ___ ___\n ( { } { } { } } ) | | / _ \\| _| _/ _ \\/ _ \\\n |`-..________ ..-'| | |___| (_) | | | || __/ __/\n | | \\_____\\___/|_| |_| \\___|\\___|\n | ;--.\n | (__ \\ _____ _ _\n | | ) ) / ____| (_) | |\n | |/ / | (___ ___ _ __ _ _ __ | |_\n | ( / \\___ \\ / __| '__| | '_ \\| __|\n | |/ ____) | (__| | | | |_) | |_\n | | |_____/ \\___|_| |_| .__/ \\__|\n `-.._________..-' | |\n |_|\n\n\n CoffeeScript is a little language that compiles into JavaScript.\n\n If you have the Node Package Manager installed:\n npm install -g coffee-script\n (Leave off the -g if you don't wish to install globally.)\n\n Or, if you don't wish to use npm:\n sudo bin/cake install\n\n Execute a script:\n coffee /path/to/script.coffee\n\n Compile a script:\n coffee -c /path/to/script.coffee\n\n For documentation, usage, and examples, see:\n http://coffeescript.org/\n\n To suggest a feature, report a bug, or general discussion:\n http://github.com/jashkenas/coffeescript/issues/\n\n If you'd like to chat, drop by #coffeescript on Freenode IRC,\n or on webchat.freenode.net.\n\n The source repository:\n git://github.com/jashkenas/coffeescript.git\n\n Top 100 contributors are listed here:\n http://github.com/jashkenas/coffeescript/contributors\n",
"readmeFilename": "README", "readmeFilename": "README",
"_id": "coffee-script@1.8.0", "_id": "coffee-script@1.8.0",
"dist": { "_from": "coffee-script@"
"shasum": "cb094abbaba89f95fb2bc75cb972c3d1f93cb262"
},
"_from": "coffee-script@",
"_resolved": "https://registry.npmjs.org/coffee-script/-/coffee-script-1.8.0.tgz"
} }
...@@ -38,5 +38,5 @@ ...@@ -38,5 +38,5 @@
"url": "https://github.com/expressjs/mime-types/issues" "url": "https://github.com/expressjs/mime-types/issues"
}, },
"_id": "mime-types@1.0.2", "_id": "mime-types@1.0.2",
"_from": "mime-types@~1.0.1" "_from": "mime-types@~1.0.0"
} }
4.8.7 / 2014-08-29
==================
* deps: qs@2.2.2
- Remove unnecessary cloning
4.8.6 / 2014-08-27 4.8.6 / 2014-08-27
================== ==================
...@@ -414,6 +420,13 @@ ...@@ -414,6 +420,13 @@
- `app.route()` - Proxy to the app's `Router#route()` method to create a new route - `app.route()` - Proxy to the app's `Router#route()` method to create a new route
- Router & Route - public API - Router & Route - public API
3.16.9 / 2014-08-29
===================
* deps: connect@2.25.9
- deps: body-parser@~1.6.7
- deps: qs@2.2.2
3.16.8 / 2014-08-27 3.16.8 / 2014-08-27
=================== ===================
......
...@@ -35,5 +35,5 @@ ...@@ -35,5 +35,5 @@
"url": "https://github.com/expressjs/accepts/issues" "url": "https://github.com/expressjs/accepts/issues"
}, },
"_id": "accepts@1.0.7", "_id": "accepts@1.0.7",
"_from": "accepts@~1.0.7" "_from": "accepts@~1.0.4"
} }
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
"url": "https://github.com/visionmedia/debug/issues" "url": "https://github.com/visionmedia/debug/issues"
}, },
"_id": "debug@1.0.4", "_id": "debug@1.0.4",
"dist": {
"shasum": "c24a85a64e0d945f6d61290d10692f4f422ee7d8"
},
"_from": "debug@1.0.4", "_from": "debug@1.0.4",
"_resolved": "https://registry.npmjs.org/debug/-/debug-1.0.4.tgz",
"scripts": {} "scripts": {}
} }
## [**2.2.2**](https://github.com/hapijs/qs/issues?milestone=11&state=open)
- [**#34**](https://github.com/hapijs/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty
- [**#24**](https://github.com/hapijs/qs/issues/24) Changelog? Semver?
---
# 2014-08-28
95 commits against 24 issues, over a month [`32edf33`](https://github.com/hapijs/qs/commit/32edf33)[`b1e7b53`](https://github.com/hapijs/qs/commit/b1e7b53)
## [**2.2.1**](https://github.com/hapijs/qs/issues?milestone=10&state=closed)
- [**#32**](https://github.com/hapijs/qs/issues/32) account for circular references properly, closes #31
- [**#31**](https://github.com/hapijs/qs/issues/31) qs.parse stackoverflow on circular objects
## [**2.2.0**](https://github.com/hapijs/qs/issues?milestone=9&state=closed)
- [**#30**](https://github.com/hapijs/qs/issues/30) Bug when merging non-object values into arrays
- [**#29**](https://github.com/hapijs/qs/issues/29) Don't call Utils.clone at the top of Utils.merge
- [**#26**](https://github.com/hapijs/qs/issues/26) Don't use Buffer global if it's not present
- [**#23**](https://github.com/hapijs/qs/issues/23) Ability to not limit parameters?
## [**2.1.0**](https://github.com/hapijs/qs/issues?milestone=8&state=closed)
- [**#22**](https://github.com/hapijs/qs/issues/22) Enable using a RegExp as delimiter
## [**2.0.0**](https://github.com/hapijs/qs/issues?milestone=7&state=closed)
- [**#20**](https://github.com/hapijs/qs/issues/20) Configurable parametersLimit
- [**#18**](https://github.com/hapijs/qs/issues/18) Why is there arrayLimit?
- [**#21**](https://github.com/hapijs/qs/issues/21) make all limits optional, for #18, for #20
## [**1.2.2**](https://github.com/hapijs/qs/issues?milestone=6&state=closed)
- [**#19**](https://github.com/hapijs/qs/issues/19) Don't overwrite null values
## [**1.2.1**](https://github.com/hapijs/qs/issues?milestone=5&state=closed)
- [**#16**](https://github.com/hapijs/qs/issues/16) ignore non-string delimiters
- [**#15**](https://github.com/hapijs/qs/issues/15) Close code block
## [**1.2.0**](https://github.com/hapijs/qs/issues?milestone=4&state=closed)
- [**#12**](https://github.com/hapijs/qs/issues/12) Add optional delim argument
- [**#13**](https://github.com/hapijs/qs/issues/13) fix #11: flattened keys in array are now correctly parsed
## [**1.1.0**](https://github.com/hapijs/qs/issues?milestone=3&state=closed)
- [**#7**](https://github.com/hapijs/qs/issues/7) Empty values of a POST array disappear after being submitted
- [**#9**](https://github.com/hapijs/qs/issues/9) Should not omit equals signs (=) when value is null
- [**#6**](https://github.com/hapijs/qs/issues/6) Minor grammar fix in README
## [**1.0.2**](https://github.com/hapijs/qs/issues?milestone=2&state=closed)
- [**#5**](https://github.com/hapijs/qs/issues/5) array holes incorrectly copied into object on large index
## Issues
- [**#25**](https://github.com/hapijs/qs/issues/25) Remove references to Buffer
- [**#11**](https://github.com/hapijs/qs/issues/11) Flattened keys in array does not parse correctly
- [**#8**](https://github.com/hapijs/qs/issues/8) Square brackets should be URI encoded
- [**#3**](https://github.com/hapijs/qs/issues/3) Update README.md
- [**#2**](https://github.com/hapijs/qs/issues/2) Add travis and rework package
...@@ -138,17 +138,17 @@ module.exports = function (str, options) { ...@@ -138,17 +138,17 @@ module.exports = function (str, options) {
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit; options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit;
options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit; options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit;
var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : Utils.clone(str); var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str;
var obj = {}; var obj = {};
// Iterate over the keys and setup the new object // Iterate over the keys and setup the new object
//
for (var key in tempObj) { var keys = Object.keys(tempObj);
if (tempObj.hasOwnProperty(key)) { for (var i = 0, il = keys.length; i < il; ++i) {
var key = keys[i];
var newObj = internals.parseKeys(key, tempObj[key], options); var newObj = internals.parseKeys(key, tempObj[key], options);
obj = Utils.merge(obj, newObj); obj = Utils.merge(obj, newObj);
} }
}
return Utils.compact(obj); return Utils.compact(obj);
}; };
...@@ -20,29 +20,6 @@ exports.arrayToObject = function (source) { ...@@ -20,29 +20,6 @@ exports.arrayToObject = function (source) {
}; };
exports.clone = function (source) {
if (typeof source !== 'object' ||
source === null) {
return source;
}
if (exports.isBuffer(source)) {
return source.toString();
}
var obj = Array.isArray(source) ? [] : {};
for (var i in source) {
if (source.hasOwnProperty(i)) {
obj[i] = exports.clone(source[i]);
}
}
return obj;
};
exports.merge = function (target, source) { exports.merge = function (target, source) {
if (!source) { if (!source) {
...@@ -83,7 +60,7 @@ exports.merge = function (target, source) { ...@@ -83,7 +60,7 @@ exports.merge = function (target, source) {
typeof value === 'object') { typeof value === 'object') {
if (!target[key]) { if (!target[key]) {
target[key] = exports.clone(value); target[key] = value;
} }
else { else {
target[key] = exports.merge(target[key], value); target[key] = exports.merge(target[key], value);
...@@ -108,32 +85,41 @@ exports.decode = function (str) { ...@@ -108,32 +85,41 @@ exports.decode = function (str) {
}; };
exports.compact = function (obj) { exports.compact = function (obj, refs) {
if (typeof obj !== 'object' ||
obj === null) {
if (typeof obj !== 'object' || obj === null) {
return obj; return obj;
} }
var compacted = {}; refs = refs || [];
var lookup = refs.indexOf(obj);
if (lookup !== -1) {
return refs[lookup];
}
refs.push(obj);
for (var key in obj) { if (Array.isArray(obj)) {
if (obj.hasOwnProperty(key)) { var compacted = [];
if (Array.isArray(obj[key])) {
compacted[key] = [];
for (var i = 0, l = obj[key].length; i < l; i++) { for (var i = 0, l = obj.length; i < l; ++i) {
if (typeof obj[key][i] !== 'undefined') { if (typeof obj[i] !== 'undefined') {
compacted[key].push(obj[key][i]); compacted.push(obj[i]);
}
}
} }
else {
compacted[key] = exports.compact(obj[key]);
} }
return compacted;
} }
var keys = Object.keys(obj);
for (var i = 0, il = keys.length; i < il; ++i) {
var key = keys[i];
obj[key] = exports.compact(obj[key], refs);
} }
return compacted; return obj;
}; };
......
{ {
"name": "qs", "name": "qs",
"version": "2.2.0", "version": "2.2.2",
"description": "A querystring parser that supports nesting and arrays, with a depth limit", "description": "A querystring parser that supports nesting and arrays, with a depth limit",
"homepage": "https://github.com/hapijs/qs", "homepage": "https://github.com/hapijs/qs",
"main": "index.js", "main": "index.js",
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
"bugs": { "bugs": {
"url": "https://github.com/hapijs/qs/issues" "url": "https://github.com/hapijs/qs/issues"
}, },
"_id": "qs@2.2.0", "_id": "qs@2.2.2",
"_from": "qs@2.2.0" "dist": {
"shasum": "2d1b60e849100ffd352b1acdb0a7cf5a139a51c8"
},
"_from": "qs@2.2.2",
"_resolved": "https://registry.npmjs.org/qs/-/qs-2.2.2.tgz"
} }
...@@ -205,10 +205,10 @@ describe('#parse', function () { ...@@ -205,10 +205,10 @@ describe('#parse', function () {
done(); done();
}); });
it('parses buffers to strings', function (done) { it('parses buffers correctly', function (done) {
var b = new Buffer('test'); var b = new Buffer('test');
expect(Qs.parse({ a: b })).to.deep.equal({ a: b.toString() }); expect(Qs.parse({ a: b })).to.deep.equal({ a: b });
done(); done();
}); });
...@@ -337,4 +337,47 @@ describe('#parse', function () { ...@@ -337,4 +337,47 @@ describe('#parse', function () {
expect(Qs.parse('roomInfoList[0].childrenAges[0]=15&roomInfoList[0].numberOfAdults=2')).to.deep.equal({ roomInfoList: [['15', '2']] }); expect(Qs.parse('roomInfoList[0].childrenAges[0]=15&roomInfoList[0].numberOfAdults=2')).to.deep.equal({ roomInfoList: [['15', '2']] });
done(); done();
}); });
it('does not crash when parsing circular references', function (done) {
var a = {};
a.b = a;
var parsed;
expect(function () {
parsed = Qs.parse({ 'foo[bar]': 'baz', 'foo[baz]': a });
}).to.not.throw(Error);
expect(parsed).to.have.key('foo');
expect(parsed.foo).to.have.keys('bar', 'baz');
expect(parsed.foo.bar).to.equal('baz');
expect(parsed.foo.baz).to.deep.equal(a);
done();
});
it('parses plain objects correctly', function (done) {
var a = Object.create(null);
a.b = 'c';
expect(Qs.parse(a)).to.deep.equal({ b: 'c' });
expect(Qs.parse({ a: a })).to.deep.equal({ a: { b: 'c' } });
done();
});
it('parses dates correctly', function (done) {
var now = new Date();
expect(Qs.parse({ a: now })).to.deep.equal({ a: now });
done();
});
it('parses regular expressions correctly', function (done) {
var re = /^test$/;
expect(Qs.parse({ a: re })).to.deep.equal({ a: re });
done();
});
}); });
...@@ -29,5 +29,5 @@ ...@@ -29,5 +29,5 @@
"url": "https://github.com/visionmedia/node-range-parser/issues" "url": "https://github.com/visionmedia/node-range-parser/issues"
}, },
"_id": "range-parser@1.0.0", "_id": "range-parser@1.0.0",
"_from": "range-parser@~1.0.0" "_from": "range-parser@1.0.0"
} }
{ {
"name": "express", "name": "express",
"description": "Fast, unopinionated, minimalist web framework", "description": "Fast, unopinionated, minimalist web framework",
"version": "4.8.6", "version": "4.8.7",
"author": { "author": {
"name": "TJ Holowaychuk", "name": "TJ Holowaychuk",
"email": "tj@vision-media.ca" "email": "tj@vision-media.ca"
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
"parseurl": "~1.3.0", "parseurl": "~1.3.0",
"path-to-regexp": "0.1.3", "path-to-regexp": "0.1.3",
"proxy-addr": "1.0.1", "proxy-addr": "1.0.1",
"qs": "2.2.0", "qs": "2.2.2",
"range-parser": "1.0.0", "range-parser": "1.0.0",
"send": "0.8.3", "send": "0.8.3",
"serve-static": "~1.5.3", "serve-static": "~1.5.3",
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
"ejs": "~1.0.0", "ejs": "~1.0.0",
"marked": "0.3.2", "marked": "0.3.2",
"hjs": "~0.0.6", "hjs": "~0.0.6",
"body-parser": "~1.6.6", "body-parser": "~1.6.7",
"cookie-parser": "~1.3.2", "cookie-parser": "~1.3.2",
"express-session": "~1.7.6", "express-session": "~1.7.6",
"jade": "~1.5.0", "jade": "~1.5.0",
...@@ -110,6 +110,10 @@ ...@@ -110,6 +110,10 @@
"bugs": { "bugs": {
"url": "https://github.com/strongloop/express/issues" "url": "https://github.com/strongloop/express/issues"
}, },
"_id": "express@4.8.6", "_id": "express@4.8.7",
"_from": "express@4.x" "dist": {
"shasum": "1033c54dcc5d0a539b9918acb62c4be9f4aaa5d7"
},
"_from": "express@4.x",
"_resolved": "https://registry.npmjs.org/express/-/express-4.8.7.tgz"
} }
...@@ -38,5 +38,5 @@ ...@@ -38,5 +38,5 @@
"url": "https://github.com/expressjs/mime-types/issues" "url": "https://github.com/expressjs/mime-types/issues"
}, },
"_id": "mime-types@1.0.2", "_id": "mime-types@1.0.2",
"_from": "mime-types@~1.0.1" "_from": "mime-types@~1.0.0"
} }
...@@ -35,5 +35,5 @@ ...@@ -35,5 +35,5 @@
"url": "https://github.com/expressjs/accepts/issues" "url": "https://github.com/expressjs/accepts/issues"
}, },
"_id": "accepts@1.0.7", "_id": "accepts@1.0.7",
"_from": "accepts@~1.0.7" "_from": "accepts@~1.0.4"
} }
...@@ -43,5 +43,9 @@ ...@@ -43,5 +43,9 @@
"url": "https://github.com/visionmedia/debug/issues" "url": "https://github.com/visionmedia/debug/issues"
}, },
"_id": "debug@1.0.4", "_id": "debug@1.0.4",
"_from": "debug@1.0.4" "dist": {
"shasum": "c24a85a64e0d945f6d61290d10692f4f422ee7d8"
},
"_from": "debug@1.0.4",
"_resolved": "https://registry.npmjs.org/debug/-/debug-1.0.4.tgz"
} }
...@@ -43,6 +43,10 @@ ...@@ -43,6 +43,10 @@
"url": "https://github.com/visionmedia/debug/issues" "url": "https://github.com/visionmedia/debug/issues"
}, },
"_id": "debug@1.0.4", "_id": "debug@1.0.4",
"dist": {
"shasum": "c24a85a64e0d945f6d61290d10692f4f422ee7d8"
},
"_from": "debug@1.0.4", "_from": "debug@1.0.4",
"_resolved": "https://registry.npmjs.org/debug/-/debug-1.0.4.tgz",
"scripts": {} "scripts": {}
} }
...@@ -41,5 +41,9 @@ ...@@ -41,5 +41,9 @@
"url": "https://github.com/visionmedia/debug/issues" "url": "https://github.com/visionmedia/debug/issues"
}, },
"_id": "debug@0.7.4", "_id": "debug@0.7.4",
"_from": "debug@0.7.4" "dist": {
"shasum": "6d61ff0bcdda31e2135e2cc0d7d6f0aa80b09c19"
},
"_from": "debug@0.7.4",
"_resolved": "https://registry.npmjs.org/debug/-/debug-0.7.4.tgz"
} }
...@@ -22,5 +22,9 @@ ...@@ -22,5 +22,9 @@
"readme": "\n# debug\n\n tiny node.js debugging utility.\n\n## Installation\n\n```\n$ npm install debug\n```\n\n## Example\n\n This module is modelled after node core's debugging technique, allowing you to enable one or more topic-specific debugging functions, for example core does the following within many modules:\n\n```js\nvar debug;\nif (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) {\n debug = function(x) {\n var prefix = process.pid + ',' +\n (process.env.NODE_WORKER_ID ? 'Worker' : 'Master');\n console.error(prefix, x);\n };\n} else {\n debug = function() { };\n}\n```\n\n This concept is extremely simple but it works well. With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.\n \nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n \n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n\n## Conventions\n\n If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". \n\n## Wildcards\n\n The \"*\" character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\n You can also exclude specific debuggers by prefixing them with a \"-\" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with \"connect:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. \n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n a('doing some work');\n}, 1200);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "readme": "\n# debug\n\n tiny node.js debugging utility.\n\n## Installation\n\n```\n$ npm install debug\n```\n\n## Example\n\n This module is modelled after node core's debugging technique, allowing you to enable one or more topic-specific debugging functions, for example core does the following within many modules:\n\n```js\nvar debug;\nif (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) {\n debug = function(x) {\n var prefix = process.pid + ',' +\n (process.env.NODE_WORKER_ID ? 'Worker' : 'Master');\n console.error(prefix, x);\n };\n} else {\n debug = function() { };\n}\n```\n\n This concept is extremely simple but it works well. With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility.\n \nExample _app.js_:\n\n```js\nvar debug = require('debug')('http')\n , http = require('http')\n , name = 'My App';\n\n// fake app\n\ndebug('booting %s', name);\n\nhttp.createServer(function(req, res){\n debug(req.method + ' ' + req.url);\n res.end('hello\\n');\n}).listen(3000, function(){\n debug('listening');\n});\n\n// fake worker of some kind\n\nrequire('./worker');\n```\n\nExample _worker.js_:\n\n```js\nvar debug = require('debug')('worker');\n\nsetInterval(function(){\n debug('doing some work');\n}, 1000);\n```\n\n The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:\n\n ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png)\n\n ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png)\n\n## Millisecond diff\n\n When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the \"+NNNms\" will show you how much time was spent between calls.\n\n ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png)\n\n When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:\n \n ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png)\n\n## Conventions\n\n If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use \":\" to separate features. For example \"bodyParser\" from Connect would then be \"connect:bodyParser\". \n\n## Wildcards\n\n The \"*\" character may be used as a wildcard. Suppose for example your library has debuggers named \"connect:bodyParser\", \"connect:compress\", \"connect:session\", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.\n\n You can also exclude specific debuggers by prefixing them with a \"-\" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with \"connect:\".\n\n## Browser support\n\n Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. \n\n```js\na = debug('worker:a');\nb = debug('worker:b');\n\nsetInterval(function(){\n a('doing some work');\n}, 1000);\n\nsetInterval(function(){\n a('doing some work');\n}, 1200);\n```\n\n## License \n\n(The MIT License)\n\nCopyright (c) 2011 TJ Holowaychuk &lt;tj@vision-media.ca&gt;\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
"readmeFilename": "Readme.md", "readmeFilename": "Readme.md",
"_id": "debug@0.6.0", "_id": "debug@0.6.0",
"_from": "debug@0.6.0" "dist": {
"shasum": "f56cb9d82bc76b3df607b6c27936d28e7c939de5"
},
"_from": "debug@0.6.0",
"_resolved": "https://registry.npmjs.org/debug/-/debug-0.6.0.tgz"
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment