Quantcast
Channel: Node.js Tools for Visual Studio
Viewing all articles
Browse latest Browse all 4630

Commented Issue: body-parser member info missing [1239]

$
0
0
```js
var bodyParser = require('body-parser');
bodyParser();
bodyParser.json();
```
`bodyParser` only displays members that are universal to all objects - no info when calling it or on `json`.

It seems that we don't correctly understand the following code in body-parser/index.js:
```
var deprecate = require('depd')('body-parser')
exports = module.exports = deprecate.function(bodyParser,
'bodyParser: use individual json/urlencoded middlewares')
```

This is meant to show a deprecation message when people call `bodyParser` as a function (you're supposed to use `json` and other members now). But it looks like it screws our ability to parse exports entirely for this module.
Comments: The issue here is actually this code: ``` var parsersDir = path.join(__dirname, 'lib', 'types') /** * Auto-load bundled parsers with getters. */ fs.readdirSync(parsersDir).forEach(function onfilename(filename) { if (!/\.js$/.test(filename)) return var loc = path.resolve(parsersDir, filename) var mod var name = path.basename(filename, '.js') function load() { if (mod) { return mod } return mod = require(loc) } Object.defineProperty(exports, name, { configurable: true, enumerable: true, get: load }) }) ``` Which we also need to understand elsewhere.

Viewing all articles
Browse latest Browse all 4630

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>