-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathindex.js
More file actions
33 lines (29 loc) · 796 Bytes
/
index.js
File metadata and controls
33 lines (29 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const transform = require('./lib/transform')
/**
* @module jsdoc-parse
* @example
* const jsdocParse = require('jsdoc-parse')
*/
/**
* @param {object[]} - jsdoc output
* @returns {object[]}
* @alias module:jsdoc-parse
*/
function jsdocParse (jsdocData) {
const data = transform(jsdocData)
return sort(data)
}
function sort (array) {
const sortBy = require('sort-array')
return sortBy(array, {
by: ['scope', 'category', 'kind', 'order'],
order: ['scope', 'asc', 'kind', 'asc'],
customOrders: {
kind: ['class', 'constructor', 'mixin', 'member', 'namespace', 'enum', 'constant', 'function', 'event', 'typedef', 'external'],
scope: ['global', 'instance', 'static', 'inner']
},
nullRank: -1,
undefinedRank: -1
})
}
module.exports = jsdocParse