2
1
mirror of https://github.com/Thream/socketio-jwt.git synced 2024-07-21 09:38:31 +02:00

refactorize to use xtend

This commit is contained in:
Jose F. Romaniello 2013-01-07 10:40:52 -03:00
parent 2b2e0b93d5
commit 79878b036c
2 changed files with 5 additions and 21 deletions

View File

@ -1,23 +1,6 @@
var connectUtils = require('connect').utils,
cookie = require('cookie');
var overwrite = function(overwritten) {
return (function() {
if( arguments.length > 1 ) {
for(var objects in arguments ) {
overwrite( this, arguments[objects] );
}
}
for( var key in arguments[0] ) {
if( arguments[0].hasOwnProperty(key) ) {
this[key] = arguments[0][key];
}
}
return this;
}).apply(overwritten, Array.prototype.slice.call(arguments, 1));
};
cookie = require('cookie'),
xtend = require('xtend');
function authorize(options) {
var auth = {
@ -29,7 +12,7 @@ function authorize(options) {
fail: null
};
overwrite( auth, options );
xtend( auth, options );
auth.userProperty = auth.passport._userProperty || 'user';

View File

@ -24,7 +24,8 @@
"passport": "~0.1.12",
"connect": "~2.4.5",
"cookie": "0.0.4",
"request": "~2.12.0"
"request": "~2.12.0",
"xtend": "~1.0.3"
},
"devDependencies": {
"should": "~1.2.1",