Within the realm of Javascript, functions hold a special status as they are deemed "first class", allowing them to be maneuvered like any other data value.
The require('debug')
command fetches a function. To clarify, the primary export from the debug
npm module is a function and not an object.
This particular function is then invoked with the argument of "express:router:route"
.
Partial application, as elucidated on Wikipedia, involves passing some state or configuration to obtain a function that corresponds to said state or config. Although this scenario may seem like partial application at first glance, it simply operates as a shortened version of:
var debug = require('debug');
debug('express:router:route');
The usage of require
should not be misconstrued as intended for partial application purposes. Rather, it signifies that the debug
package returns a function, which is promptly executed in its place.