documentationjs / documentationjs/documentation

ES6 class constructor doesn't support destructured function parameters

Open
#1,306 1 comment 4 reactions 1 assignee Claimed by @anthony-redFox View on GitHub
Dominant language
JavaScript
Stars
5.8k
Forks
481
PR merge metrics
No merged PRs in 30d

Description

# Information
- Node.js version: 12.14.1
- npm version: 6.11.3
- Documentation.js version: 12.1.4
- Method of running:
- Node.js / npm
- Installed documentation.js globally using `npm install -g documentation`
- Running `documentation build test.js -f md > test.md`
- Expected behavior
- Parameters block for class constructor should use `animals` instead of `$0` and maintain documentation for `fishes` parameters

# Input code (test.js)

```javascript
/** test class */
export class Test {

/**
* This method has hierarchical params
* @param {Object} animals different kinds of animals
* @param {String} animals.fishes number of kinds of fish
*/
constructor({ fishes, foxes }) {
return fishes + foxes;
}

/**
* This method has hierarchical params
* @param {Object} animals different kinds of animals
* @param {String} animals.fishes number of kinds of fish
*/
method1({ fishes, foxes }) {
return fishes + foxes;
}

}
```

# Output documentation (test.md)

### Table of Contents

- [Test][1]
- [Parameters][2]
- [method1][3]
- [Parameters][4]

## Test

test class

### Parameters

- `$0` **[Object][5]**
- `$0.fishes`
- `$0.foxes`
- `animals` **[Object][5]** different kinds of animals

### method1

This method has hierarchical params

#### Parameters

- `animals` **[Object][5]** different kinds of animals
- `animals.fishes` **[String][6]** number of kinds of fish
- `animals.foxes`

[1]: #test

[2]: #parameters

[3]: #method1

[4]: #parameters-1

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.