|
1 |
| -var getParent = require("bit-docs-process-tags/get-parent"), |
2 |
| - tnd = require("bit-docs-type-annotate").typeNameDescription; |
| 1 | +var getParent = require("bit-docs-process-tags/get-parent"); |
| 2 | +var tnd = require("bit-docs-type-annotate").typeNameDescription; |
3 | 3 |
|
4 |
| - var funcMatch = /(?:([\w\.\$]+)|(["'][^"']+["']))\s*[=]\s*function\s?\(([^\)]*)/, |
5 |
| - codeMatch = /([\w\.\$]+?).extend\(\s*["']([^"']*)["']/; |
| 4 | +var funcMatch = /(?:([\w\.\$]+)|(["'][^"']+["']))\s*[=]\s*function\s?\(([^\)]*)/; |
| 5 | +var codeMatch = /([\w\.\$]+?).extend\(\s*["']([^"']*)["']/; |
6 | 6 |
|
7 | 7 | /**
|
8 |
| - * @module {bit-docs-process-tags/tag} bit-docs-js/tags/constructor @constructor |
9 | 8 | * @parent bit-docs-js/tags
|
| 9 | + * @module {bit-docs-process-tags/tag} bit-docs-js/tags/constructor @constructor |
10 | 10 | * @hide
|
11 | 11 | *
|
12 | 12 | * Document a constructor function.
|
13 | 13 | *
|
14 | 14 | * @signature `@constructor NAME [TITLE]`
|
15 | 15 | */
|
16 |
| - module.exports = { |
17 |
| - codeMatch: function(code){ |
18 |
| - return codeMatch.test(code); |
19 |
| - }, |
20 |
| - code: function( code ) { |
21 |
| - |
22 |
| - var parts = code.match(codeMatch); |
23 |
| - if ( parts ) { |
24 |
| - return { |
25 |
| - name: parts[2], |
26 |
| - inherits: parts[1].replace(/^\$./, "jQuery."), |
27 |
| - type: "constructor" |
28 |
| - }; |
29 |
| - } |
30 |
| - parts = code.match(funcMatch) |
| 16 | +module.exports = { |
| 17 | + codeMatch: function(code){ |
| 18 | + return codeMatch.test(code); |
| 19 | + }, |
| 20 | + code: function( code ) { |
31 | 21 |
|
32 |
| - if ( parts ) { |
33 |
| - return { |
34 |
| - name: parts[1] ? parts[1].replace(/^this\./, "") : parts[2], |
35 |
| - type: "constructor" |
36 |
| - }; |
37 |
| - } |
38 |
| - }, |
39 |
| - codeScope: true, |
40 |
| - add: function(line, curData, scope, docMap){ |
| 22 | + var parts = code.match(codeMatch); |
| 23 | + if ( parts ) { |
| 24 | + return { |
| 25 | + name: parts[2], |
| 26 | + inherits: parts[1].replace(/^\$./, "jQuery."), |
| 27 | + type: "constructor" |
| 28 | + }; |
| 29 | + } |
| 30 | + parts = code.match(funcMatch) |
41 | 31 |
|
42 |
| - // it's possible this has already been matched as something else ... clear parent |
| 32 | + if ( parts ) { |
| 33 | + return { |
| 34 | + name: parts[1] ? parts[1].replace(/^this\./, "") : parts[2], |
| 35 | + type: "constructor" |
| 36 | + }; |
| 37 | + } |
| 38 | + }, |
| 39 | + codeScope: true, |
| 40 | + add: function(line, curData, scope, docMap){ |
43 | 41 |
|
44 |
| - this.type = "constructor"; |
45 |
| - var data = tnd(line); |
46 |
| - if(data.name) { |
47 |
| - this.name = data.name; |
48 |
| - } |
| 42 | + // it's possible this has already been matched as something else ... clear parent |
49 | 43 |
|
50 |
| - this.title = data.description; |
51 |
| - return ["scope",this]; |
| 44 | + this.type = "constructor"; |
| 45 | + var data = tnd(line); |
| 46 | + if(data.name) { |
| 47 | + this.name = data.name; |
52 | 48 | }
|
53 |
| - }; |
| 49 | + |
| 50 | + this.title = data.description; |
| 51 | + return ["scope",this]; |
| 52 | + } |
| 53 | +}; |
0 commit comments