-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(javascript): Add pattern for functions inside objects
- Loading branch information
Showing
5 changed files
with
172 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# ============================================================================== | ||
# Anonymous functions inside objects without parameters. | ||
# ============================================================================== | ||
Given javascript (anonymous function inside object without parameters): | ||
var myObj = { | ||
myFunc: function(/* inline comment */) { | ||
// | ||
}, | ||
myArrowFunc: (/* inline comment */) => { | ||
// | ||
}, | ||
}; | ||
|
||
Do (trigger doge): | ||
:2\<CR> | ||
\<C-d> | ||
:10\<CR> | ||
\<C-d> | ||
|
||
Expect javascript (generated comment with nothing but the text 'TODO' and @function tag): | ||
var myObj = { | ||
/** | ||
* [TODO:description] | ||
* | ||
* @function myFunc | ||
*/ | ||
myFunc: function(/* inline comment */) { | ||
// | ||
}, | ||
/** | ||
* [TODO:description] | ||
* | ||
* @function myArrowFunc | ||
*/ | ||
myArrowFunc: (/* inline comment */) => { | ||
// | ||
}, | ||
}; | ||
|
||
|
||
# ============================================================================== | ||
# Async named functions with parameters without type hints. | ||
# ============================================================================== | ||
|
||
Given javascript (functions with punctation with parameters without type hints): | ||
var myObj = { | ||
'my-func': async function test($p1: string = 'value', p2: array = [], p3, p4 /* inline comment */) { | ||
// | ||
}, | ||
'my-arrow-func': async ($p1: string = 'value', p2: array = [], p3, p4 /* inline comment */) => { | ||
// | ||
}, | ||
}; | ||
|
||
Do (trigger doge): | ||
:2\<CR> | ||
\<C-d> | ||
:15\<CR> | ||
\<C-d> | ||
|
||
Expect javascript (generated comment with @async, @function and @param tags): | ||
var myObj = { | ||
/** | ||
* [TODO:description] | ||
* | ||
* @async | ||
* @function my-func | ||
* @param {string} $p1 [TODO:description] | ||
* @param {array} p2 [TODO:description] | ||
* @param {[TODO:type]} p3 [TODO:description] | ||
* @param {[TODO:type]} p4 [TODO:description] | ||
*/ | ||
'my-func': async function test($p1: string = 'value', p2: array = [], p3, p4 /* inline comment */) { | ||
// | ||
}, | ||
/** | ||
* [TODO:description] | ||
* | ||
* @async | ||
* @function my-arrow-func | ||
* @param {string} $p1 [TODO:description] | ||
* @param {array} p2 [TODO:description] | ||
* @param {[TODO:type]} p3 [TODO:description] | ||
* @param {[TODO:type]} p4 [TODO:description] | ||
*/ | ||
'my-arrow-func': async ($p1: string = 'value', p2: array = [], p3, p4 /* inline comment */) => { | ||
// | ||
}, | ||
}; |
This file contains 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