Now working on node 0.1.30 but using custom mixin
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by ciaranj · committed by ciaranj · parent 496de51 · Browse files · 3 files·+76 added−11 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+76 added−11 removed
- other:+76 added−11 removed
Provenance
- Commit
8621786- Tree
b217a38- Author
ciaranj <ciaranj@gmail.com>- Committer
ciaranj <ciaranj@gmail.com>- Parent
496de51
3 files changed+76 added−11 removed
modified:lib/express/plugins/view.js+5 added-1 removed
61 unmodified lines6263646566676869707172733 unmodified lines7778798077818283848519 unmodified lines61 unmodified lines * @api public */
render: function(view, options) { var sys= require('sys'); sys.puts(sys.inspect(options)); var self = this, options = options || {}, path = set('views') + '/' + view, type = path.split('.').slice(-2)[0],3 unmodified lines self.contentType(ext) function render(content) { content = engine[type].render(content, options) if (layout) self.render(layout + '.' + type + '.' + ext, process.mixin(true, options, { self.render(layout + '.' + type + '.' + ext, utils.mixin(true, options, { layout: false, locals: { body: content }19 unmodified linesmodified:lib/express/core.js+8 added-9 removed
1 2 // Express - Core - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)3+var utils = require('express/utils');4+utils.mixin(require('sys'))5+utils.mixin(require('express/exceptions'))6+utils.mixin(require('express/collection'))7+utils.mixin(require('express/event'))8+utils.mixin(require('express/request'))9+utils.mixin(require('express/plugin'))10+utils.mixin(require('express/dsl'))11 4-process.mixin(require('sys'))5-process.mixin(require('express/exceptions'))6-process.mixin(require('express/collection'))7-process.mixin(require('express/event'))8-process.mixin(require('express/request'))9-process.mixin(require('express/plugin'))10-process.mixin(require('express/dsl'))11-12 /**13 * Module dependencies.14 */15 16 var multipart = require('multipart'),17 events = require('events'),18- utils = require('express/utils'),18 fs = require('fs')19 20 // --- Route21 301 unmodified linesmodified:lib/express/utils.js+63 added-1 removed
143 unmodified lines144 function Clone() {}145 exports.clone = function(obj) {146 Clone.prototype = obj147 return new Clone148-}148+}149+150+// From jQuery.extend in the jQuery JavaScript Library v1.3.2151+// Copyright (c) 2009 John Resig152+// Dual licensed under the MIT and GPL licenses.153+// http://docs.jquery.com/License154+// Modified for node.js (formely for copying properties correctly)155+exports.mixin = function() {156+ // copy reference to target object157+ var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, source;158+159+ // Handle a deep copy situation160+ if ( typeof target === "boolean" ) {161+ deep = target;162+ target = arguments[1] || {};163+ // skip the boolean and the target164+ i = 2;165+ }166+167+ // Handle case when target is a string or something (possible in deep copy)168+ if ( typeof target !== "object" && !(typeof target === 'function') )169+ target = {};170+171+ // mixin process itself if only one argument is passed172+ if ( length == i ) {173+ target = GLOBAL;174+ --i;175+ }176+177+ for ( ; i < length; i++ ) {178+ // Only deal with non-null/undefined values179+ if ( (source = arguments[i]) != null ) {180+ // Extend the base object181+ Object.getOwnPropertyNames(source).forEach(function(k){182+ var d = Object.getOwnPropertyDescriptor(source, k) || {value: source[k]};183+ if (d.get) {184+ target.__defineGetter__(k, d.get);185+ if (d.set) {186+ target.__defineSetter__(k, d.set);187+ }188+ }189+ else {190+ // Prevent never-ending loop191+ if (target === d.value) {192+ continue;193+ }194+195+ if (deep && d.value && typeof d.value === "object") {196+ target[k] = process.mixin(deep,197+ // Never move original objects, clone them198+ target[k] || (d.value.length != null ? [] : {})199+ , d.value);200+ }201+ else {202+ target[k] = d.value;203+ }204+ }205+ });206+ }207+ }208+ // Return the modified object209+ return target;210+};