2
2
3
3
const clients = require ( './clients' )
4
4
5
+ /**
6
+ * @typedef {Object } ClientInfo
7
+ * @prop {string } key - e.g. "curl"
8
+ * @prop {string } title - e.g. "cURL"
9
+ * @prop {string } link - href linking to client website.
10
+ * @prop {string } description
11
+ * @prop {string } target - {Target}.key
12
+ */
13
+
14
+ /**
15
+ * @typedef {Object } Client
16
+ * @prop {Function } - code building function
17
+ * @prop {ClientInfo } info - info about client
18
+ */
19
+
20
+ /**
21
+ * @typedef {Object } Target
22
+ * @prop {string } key - e.g. "javascript"
23
+ * @prop {string } title - e.g. "Javascript"
24
+ * @prop {string } extname - extension name, e.g. .js, .sh, .py
25
+ * @prop {string } default - default {Client}.info.key
26
+ * @prop {Array<Client> } clients
27
+ */
28
+
5
29
module . exports = ( function ( ) {
6
30
const baseTargets = {
7
31
shell : { key : 'shell' , title : 'Shell' , extname : '.sh' , default : 'curl' } ,
@@ -57,6 +81,10 @@ module.exports = (function () {
57
81
match
58
82
}
59
83
84
+ /**
85
+ * Includes client files with their code building functions + infos
86
+ * @returns {Object.<string, { clients: Object.<string, Client>, key, title, extname,default }> }
87
+ */
60
88
function all ( ) {
61
89
const targets = Object . keys ( clients ) . reduce ( ( acc , client ) => {
62
90
const info = clients [ client ] && clients [ client ] . info
@@ -83,6 +111,9 @@ module.exports = (function () {
83
111
} )
84
112
}
85
113
114
+ /**
115
+ * @returns {Array<Target> }
116
+ */
86
117
function available ( ) {
87
118
return all ( ) . map ( target => {
88
119
return {
0 commit comments