I'm starting to play around with Node.js and specifically with the LessCSS compiler. I saw this call on the source code of the lessc script:
new(less.Parser) ({
paths: [path.dirname(input)].concat(options.paths),
optimization: options.optimization,
filename: input,
strictImports: options.strictImports,
dumpLineNumbers: options.dumpLineNumbers
}).parse(data, function (err, tree) {
//...
});
What I don't understand is how that new(lessParser)({})
call works.
From what I've been reading about Object-oriented Javascript I only found examples of new being called like so: object = new Someting
So the questions are: how does new
work in that case? Is it calling less.Parser
as the constructor? Also, what are the parenthesis (following the new call) executing/returning?
Thanks!