Doing this apnagent
tutorial and I do not understand what is the purpose of 'piping' of setting values in the second line.
var apnagent = require('apnagent')
, agent = module.exports = new apnagent.Agent(); // <--- WHY this here
Especially I do not understand why module.exports = agent;
needs, if earlier in tutorial there is a line like this:
module.exports = "<a1b56d2c 08f621d8 7060da2b c3887246 f17bb200 89a9d44b fb91c7d0 97416b30>";
Why does module.exports
need to be overwritten?
It's not really piping, actually, there's no
|
(pipe) as in the Unix world.This pattern makes sure
new apnagent.Agent()
is accessible in both the local scope withagent
and throughrequire
viamodule.exports
.It's exactly the same as doing: