Skip to content
Myr

Removed process.mixin() dependency

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

authored by visionmedia · committed by visionmedia · parent 364c131 · Browse files · 11 files+29 added−160 removed
This commit

State

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

Diff stats

11 files+29 added−160 removed

  • tests:+7 added−1 removed
  • other:+22 added−159 removed

11 files+29 added−160 removed

deleted:benchmarks/benchmark.js-83 removed
12;(function(){3 var currentSuite4 5 /**6 * Contents of _fn_. Strips function literal and signature.7 *8 * @param {function} fn9 * @return {string}10 * @api private11 */12 13 function contentsOf(fn) {14 return fn.toString().match(/^[^\{]*{((.*\n*)*)}/m)[1]15 }16 17 /**18 * Pad _str_ to _len_.19 *20 * @param {string} str21 * @param {integer} len22 * @return {string}23 * @api private24 */25 26 function pad(str, len) {27 return str + (new Array(len - str.length)).join(' ')28 }29 30 /**31 * Time the execution of _fn_32 *33 * @param {function} fn34 * @return {float}35 * @api private36 */37 38 function time(fn) {39 var start = Number(new Date)40 fn()41 return (Number(new Date) - start) / 100042 }43 44 /**45 * Benchmark _fn_ with the given _label_.46 *47 * @param {string} label48 * @param {function} fn49 * @api public50 */51 52 function benchmark(label, fn) {53 var duration = time(function(){54 for (var i = 0; i < currentSuite.times; ++i)55 fn()56 }).toFixed(3)57 print(pad(' ' + label, 50 - duration.toString().length) + duration + ' |')58 }59 60 /**61 * Create a benchmark suite with the given _label_, which62 * will run each benchmark n _times_. If _times_ is omitted63 * then it defaults to 1.64 *65 * @param {string} label66 * @param {integer, function} times67 * @param {function} fn68 * @api public69 */70 71 suite = function(label, times, fn) {72 currentSuite = this73 if (typeof times == 'function')74 this.times = 1, fn = times75 else76 this.times = times77 print('\n ' + pad(label, 42 - this.times.toString().length) + this.times + ' time(s)')78 print(' -------------------------------------------------')79 eval(contentsOf(fn))80 print('')81 }82 83})()
deleted:benchmarks/views.js-56 removed
modified:lib/express/plugins/cache.js+1 added-1 removed
194 unmodified lines
195 * @api private196 */197 198 init: function(options) {199 process.mixin(this, options)199 this.merge(options || {})200 this.store = new (this.dataStore || exports.Store.Memory)(options)201 Request.include({ cache: this.store })202 this.startReaper()203 },
17 unmodified lines
modified:lib/express/plugins/hooks.js+8 added-2 removed
modified:lib/express/plugins/profiler.js+1 added-1 removed
modified:lib/express/plugins/session.js+1 added-1 removed
155 unmodified lines
156 * @api private157 */158 159 init: function(options) {160 process.mixin(this, options)160 this.merge(options || {})161 this.store = new (this.dataStore || exports.Store.Memory)(options)162 this.startReaper()163 },164
41 unmodified lines
modified:lib/express/spec/mocks.js+7 added-1 removed
12// Express - MockRequest - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)34/**5 * Module dependencies.6 */7 8var utils = require('express/utils')910// --- MockRequest1112var MockRequest = Class({13
24 unmodified lines
38 'accept': 'application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',39 'accept-language': 'en-us',40 'connection': 'keep-alive'41 }36 process.mixin(true, this, options)42 utils.mixin(true, this, options)43 }44})4546// --- MockResponse
89 unmodified lines
modified:lib/express/core.js+6 added-6 removed
8 unmodified lines
9 utils = require('express/utils'),10 events = require('events'),11 fs = require('fs')1213utils.mixin(require('sys'))14utils.mixin(require('express/exceptions'))15utils.mixin(require('express/event'))16utils.mixin(require('express/request'))17utils.mixin(require('express/plugin'))18utils.mixin(require('express/dsl'))13global.merge(require('sys'))14global.merge(require('express/exceptions'))15global.merge(require('express/event'))16global.merge(require('express/request'))17global.merge(require('express/plugin'))18global.merge(require('express/dsl'))1920// --- Route2122Route = Class({
313 unmodified lines
modified:lib/express/event.js+2 added-1 removed
modified:lib/express/request.js+2 added-4 removed
219 unmodified lines
220 * @api public221 */222223 trigger: function(name, data) {224 data = process.mixin(data || {}, {225 request: this,226 response: this.response227 })224 data = data || {}225 data.merge({ request: this, response: this.response })226 this.plugins.each(function(plugin){227 plugin.trigger(new Event(name, data))228 })229 return this
44 unmodified lines
modified:Makefile+1 added-4 removed
15 unmodified lines
16 17app-upload:18 @$(NODE) examples/upload/app.js19 20benchmark:21 @$(NODE) benchmarks/views.js22 23.PHONY: init test benchmark app20.PHONY: init test app