News for hackers. Stuff that matters.
Re:NodeBB: Node.js-based forum software by guiomie on Monday June 23, 2014 @08:51AM (#7931617)
Since this is a link to a github repo, I checked the source code. I personally using tabs as opposed to 2 or 3 spaces makes the code ugly.

Can someone help me undertand "require('./user/auth')(User); " ?? from https://github.com/NodeBB/NodeBB/blob/master/src/user.js

Re:NodeBB: Node.js-based forum software by runj__ on Monday June 23, 2014 @09:07AM (#7931687)
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).

Re:NodeBB: Node.js-based forum software by b3n on Tuesday June 24, 2014 @07:50AM (#7937177)
> 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.

[1] http://www.w3.org/TR/css3-text/#tab-size

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.
Re:NodeBB: Node.js-based forum software by guiomie on Monday June 23, 2014 @12:39PM (#7932883)
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.