It initializes the Auth module with the User object. The Auth module in turn extends the User object with the property 'auth'.
The auth property is then extended with a 'logAttempt' function and a 'clearLoginAttempts' function.
The User object in the parent context can then use these properties.
Oh, and I agree that the tabbing makes it look ridiculous. Javascript should use two spaces, nothing more, nothing less (let the fight begin).
> Oh, and I agree that the tabbing makes it look ridiculous. Javascript should use two spaces, nothing more, nothing less (let the fight begin).
That's not the code's fault, GitHub should set the tab-size[1] property to something more legible.
Re:NodeBB: Node.js-based forum software
by simon_renoult on Monday June 23, 2014 @09:22AM
(#7931769)
"require('./user/auth')(User);" is a simple call to the "./user/auth" module with User as a parameter. Check https://github.com/NodeBB/NodeBB/blob/master/src/user/auth.j...
Re:NodeBB: Node.js-based forum software
by Q_the_Novice on Monday June 23, 2014 @09:11AM
(#7931710)
Also found the coding style a bit complicated and confusing - looks like they are passing the User module to other modules(in this case the auth module) and adding methods.
Yah, the module is actually an exported function. Makes sense, but a bit confusing.
Re:NodeBB: Node.js-based forum software
by romanovcode on Monday June 23, 2014 @01:41PM
(#7933255)
require, require, require.
Reminds me of early php days puke.
Can someone help me undertand "require('./user/auth')(User); " ?? from https://github.com/NodeBB/NodeBB/blob/master/src/user.js