Skip to content
Myr

Express.argsArray() -> Express.toArray()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 7c733b8 · Browse files · 2 files+10 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−10 removed

  • tests:+4 added−4 removed
  • other:+6 added−6 removed

2 files+10 added−10 removed

modified:lib/express.core.js+6 added-6 removed
153 unmodified lines
154 hook : function(name, args) {155 var results = []156 for (var i = 0, len = this.modules.length; i < len; ++i)157 for (var key in this.modules[i][name])158 results.push(this.modules[i][name][key].apply(this.modules[i], this.argsArray(arguments, 1))) 158 results.push(this.modules[i][name][key].apply(this.modules[i], this.toArray(arguments, 1))) 159 return results160 },161 162 /**
26 unmodified lines
189 addModule : function(module, args) {190 Express.settings[module.name] = {}191192 if ('init' in module) 193 module.init.apply(module, Express.argsArray(arguments, 1))193 module.init.apply(module, Express.toArray(arguments, 1))194195 if ('settings' in module) {196 if (!module.name) throw 'module name is required when using .settings'197 for (var name in module.settings)
405 unmodified lines
603 replace(/>/g, '&gt;')604 },605 606 /**607 * Convert native arguments object into an607 * Convert native array-like objects into an608 * array with optional _offset_.609 *610 * @param {arguments} args610 * @param {object} arr611 * @param {int} offset612 * @return {array}613 * @api public614 */615 616 argsArray : function(args, offset) {617 return Array.prototype.slice.call(args, offset)616 toArray : function(arr, offset) {617 return Array.prototype.slice.call(arr, offset)618 },619 620 /**621 * Check if _route_ matches provides the proper
110 unmodified lines
modified:spec/spec.core.js+4 added-4 removed
4 unmodified lines
5 end6 7 describe '.version'8 it 'should be properly formatted'9 Express.version.should.match /\d+\.\d+\.\d+/9 Express.version.should.match(/^\d+\.\d+\.\d+$/)10 end11 end12 13 describe '.parseParams()'
28 unmodified lines
42 parts.domain.should.eql 'example.net'43 end44 end45 46 describe '.argsArray()'46 describe '.toArray()'47 it 'should return an array of arguments'48 Express.argsArray(-{ return arguments }('foo', 'bar')).should.eql ['foo', 'bar']48 Express.toArray(-{ return arguments }('foo', 'bar')).should.eql ['foo', 'bar']49 end50 51 it 'should allow an offset'52 Express.argsArray(-{ return arguments }('foo', 'bar'), 1).should.eql ['bar']52 Express.toArray(-{ return arguments }('foo', 'bar'), 1).should.eql ['bar']53 end54 end55 56 describe '.escape()'
186 unmodified lines