refactorize to use xtend
This commit is contained in:
23
lib/index.js
23
lib/index.js
@ -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';
|
||||
|
||||
|
Reference in New Issue
Block a user