Created
December 9, 2019 08:54
-
-
Save idettman/57b985af69ff1379c439b81c035def3c to your computer and use it in GitHub Desktop.
JSDoc external function example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // my-new-type.js | |
| /** | |
| * MyNewType definition | |
| * @typedef {MyNewType} MyNewType | |
| * @param {number} first | |
| * @param {number} second | |
| * @property {function} logFirst | |
| * @property {function} logSecond | |
| * @returns MyNewType | |
| */ | |
| var MyNewType = module.exports = (first, second) => { | |
| /** | |
| * logs first argument | |
| * @typedef {number} logFirst | |
| * @param {number} times | |
| */ | |
| function logFirst(times) { | |
| for (let i = 0; i < times; i++) { | |
| console.log(first); | |
| } | |
| } | |
| /** | |
| * logs second argument | |
| * @param {number} times | |
| */ | |
| function logSecond(times) { | |
| for (let i = 0; i < times; i++) { | |
| console.log(second); | |
| } | |
| } | |
| return { | |
| logFirst, | |
| logSecond | |
| }; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment