The question is a simple one.
Here is how the module exports the function.
exports = module.exports = debug.debug = debug;
Here is how the ES5 module consumes it.
var debug = require('debug')('http')
Now in Typescript it's a bit different.
import * as debug from 'debug';
This returns a strange object that I have never seen before, a nested object without a key value pair.
{ [Function: debug]
coerce: [Function: coerce],
disable: [Function: disable],
// More properties go here
}
How do I invoke the function debug
I found it digging through the documentation
const log = debug('http');
log.log = console.log.bind(console); // binding to console
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.