Converted more to use class.js
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parent 6505f32 · Browse files · 7 files·+11 added−26 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+11 added−26 removed
- tests:+3 added−3 removed
- other:+8 added−23 removed
Provenance
- Commit
63cc7eb- Tree
cb0c392- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent
6505f32
7 files changed+11 added−26 removed
modified:lib/express/plugins/session.js+2 added-2 removed
7 unmodified lines8 var utils = require('express/utils')9 10 // --- Session11 12-var Session = Class({12+var Session = new NewClass({13 14 /**15 * Initialize session _sid_.16 */17 18- init: function(sid) {18+ constructor: function(sid) {19 this.id = sid20 this.touch()21 },22 179 unmodified linesmodified:lib/express/spec/mocks.js+3 added-3 removed
7 unmodified lines8910111212131415168 unmodified lines2526272829293031323310 unmodified lines4445464748484950515283 unmodified lines7 unmodified linesvar utils = require('express/utils')
// --- MockRequest
var MockRequest = Class({var MockRequest = new NewClass({ /** * Default HTTP version. */8 unmodified lines * @param {hash} options * @api private */ init: function(method, path, options) { constructor: function(method, path, options) { this.method = method this.url = path this.connection = { remoteAddress: '127.0.0.1'10 unmodified lines})
// --- MockResponse
var MockResponse = Class({var MockResponse = new NewClass({ /** * Store _code_ and _headers_. */83 unmodified linesmodified:lib/express/event.js+2 added-2 removed
12344567891011121314141516171811 unmodified lines
// Express - Event - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
exports.Event = Class({exports.Event = new NewClass({ /** * Initialize with event _name_ and optional _data_. * * @param {string} name * @param {hash} data * @api private */ init: function(name, data) { constructor: function(name, data) { this.name = name this.merge(data || {}) }, 11 unmodified linesmodified:lib/express/http.js-1 removed
41 unmodified lines42 else43 headers['content-length'] = data.length,44 headers['content-type'] = 'application/x-www-form-urlencoded'45 }46- 46 var req = client.request(method, path + search + hash, headers)47 if (data && method !== 'GET') req.write(data)48 req.addListener('response', function(res){49 if (req.statusCode < 200 || req.statusCode >= 400)44 unmodified linesmodified:lib/express/plugin.js+2 added-2 removed
30 unmodified lines31 }32 33 // --- Plugin34 35-exports.Plugin = Class({35+exports.Plugin = new NewClass({36 37 /**38 * Initialize with _options_.39 *40 * @param {hash} options41 * @api private42 */43 44- init: function(options) {44+ constructor: function(options) {45 if (options)46 utils.mixin(this, options)47 },48 13 unmodified linesmodified:lib/express/static.js+2 added-2 removed
8 unmodified lines9 fs = require('fs')10 11 // --- File12 13-exports.File = Class({13+exports.File = new NewClass({14 15 /**16 * Initialize with file _path_.17 *18 * @param {string} path19 * @api public20 */21 22- init: function(path) {22+ constructor: function(path) {23 this.path = path24 if (path.indexOf('..') != -1)25 Error.raise('InvalidPathError', "`" + path + "' is not a valid path")26 },35 unmodified linesmodified:lib/express/utils.js-14 removed
73 unmodified lines74 }, queryString.parseQuery(key))75 return orig76 }77 78-/**79- * Return a clone of _obj_.80- *81- * @param {mixed} obj82- * @return {mixed}83- * @api public84- */85-86-function Clone() {}87-exports.clone = function(obj) {88- Clone.prototype = obj89- return new Clone90-}91-78 // From jQuery.extend in the jQuery JavaScript Library v1.3.279 // Copyright (c) 2009 John Resig80 // Dual licensed under the MIT and GPL licenses.81 // http://docs.jquery.com/License56 unmodified lines