Skip to content

Commit 6333b22

Browse files
committed
remove support for node < v8
1 parent a68444b commit 6333b22

9 files changed

Lines changed: 575 additions & 69 deletions

File tree

.travis.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
language: node_js
22
node_js:
3-
- 9
3+
- 12
4+
- 10
45
- 8
5-
- 7
6-
- 6
7-
- 5
8-
- 4

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014-18 Lloyd Brookes <75pound@gmail.com>
3+
Copyright (c) 2014-19 Lloyd Brookes <75pound@gmail.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![view on npm](http://img.shields.io/npm/v/jsdoc-parse.svg)](https://www.npmjs.org/package/jsdoc-parse)
22
[![npm module downloads](http://img.shields.io/npm/dt/jsdoc-parse.svg)](https://www.npmjs.org/package/jsdoc-parse)
33
[![Build Status](https://travis-ci.org/jsdoc2md/jsdoc-parse.svg?branch=master)](https://travis-ci.org/jsdoc2md/jsdoc-parse)
4-
[![Dependency Status](https://david-dm.org/jsdoc2md/jsdoc-parse.svg)](https://david-dm.org/jsdoc2md/jsdoc-parse)
4+
[![Dependency Status](https://badgen.net/david/dep/jsdoc2md/jsdoc-parse)](https://david-dm.org/jsdoc2md/jsdoc-parse)
55
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
66
[![Join the chat at https://gitter.im/jsdoc2md/jsdoc2md](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jsdoc2md/jsdoc2md?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
77

@@ -24,4 +24,4 @@ $ jsdoc2md --json <files>
2424

2525
* * *
2626

27-
&copy; 2014-18 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
27+
&copy; 2014-19 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
'use strict'
2-
const transform = require('./transform')
1+
const transform = require('./lib/transform')
32

43
/**
54
* @module jsdoc-parse
65
* @example
76
* const jsdocParse = require('jsdoc-parse')
87
*/
9-
module.exports = jsdocParse
108

119
/**
1210
* @param {object[]} - jsdoc output
1311
* @returns {object[]}
1412
* @alias module:jsdoc-parse
1513
*/
1614
function jsdocParse (jsdocData) {
17-
let data = transform(jsdocData)
15+
const data = transform(jsdocData)
1816
return sort(data)
1917
}
2018

2119
function sort (array, properties) {
2220
const sortBy = require('sort-array')
2321
const customOrder = {
24-
kind: [ 'class', 'constructor', 'mixin', 'member', 'namespace', 'enum', 'constant', 'function', 'event', 'typedef', 'external' ],
25-
scope: [ 'global', 'instance', 'static', 'inner' ]
22+
kind: ['class', 'constructor', 'mixin', 'member', 'namespace', 'enum', 'constant', 'function', 'event', 'typedef', 'external'],
23+
scope: ['global', 'instance', 'static', 'inner']
2624
}
27-
properties = properties || [ 'scope', 'category', 'kind', 'order' ]
25+
properties = properties || ['scope', 'category', 'kind', 'order']
2826
return sortBy(array, properties, customOrder)
2927
}
28+
29+
module.exports = jsdocParse

jsdoc2md/README.hbs

Lines changed: 0 additions & 27 deletions
This file was deleted.

lib/transform.js

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use strict'
21
const testValue = require('test-value')
32
const where = testValue.where
43
const arrayify = require('array-back')
@@ -86,11 +85,6 @@ function setID (doclet) {
8685
return doclet
8786
}
8887

89-
function setParentID (doclet) {
90-
doclet.parentId = doclet.memberof
91-
return doclet
92-
}
93-
9488
/**
9589
run after setIsExportedFlag has processed using old name value
9690
@depends setIsExportedFlag
@@ -123,7 +117,7 @@ function createConstructor (class_) {
123117

124118
const replacements = []
125119
class_ = Object.assign({}, class_)
126-
const constructorProperties = [ 'description', 'params', 'examples', 'returns', 'exceptions' ]
120+
const constructorProperties = ['description', 'params', 'examples', 'returns', 'exceptions']
127121
const constructor = pick(class_, constructorProperties)
128122
for (const prop of constructorProperties) delete class_[prop]
129123
if (class_.classdesc) {
@@ -155,7 +149,7 @@ function insertConstructors (data) {
155149
})
156150

157151
replacements.reverse().forEach(function (replacement) {
158-
var spliceArgs = [ replacement.index, 1 ].concat(replacement.items)
152+
var spliceArgs = [replacement.index, 1].concat(replacement.items)
159153
data.splice.apply(data, spliceArgs)
160154
})
161155

@@ -167,12 +161,6 @@ hence the need for these four functions */
167161
function getEs6Constructor (data, parent) {
168162
return data.find(i => isES6Constructor(i) && i.memberof === parent.longname)
169163
}
170-
function isES5Class (doclet) {
171-
return testValue(doclet, {
172-
kind: 'class',
173-
meta: { code: { type: 'FunctionDeclaration' } }
174-
})
175-
}
176164
function isES6Class (doclet) {
177165
return testValue(doclet, {
178166
kind: 'class',
@@ -258,7 +246,7 @@ function cleanProperties (doclet) {
258246
}
259247

260248
function wantedProperties (input) {
261-
return omit(input, [ 'comment', 'meta', 'undocumented', '___id', '___s' ])
249+
return omit(input, ['comment', 'meta', 'undocumented', '___id', '___s'])
262250
}
263251

264252
function buildTodoList (doclet) {
@@ -344,7 +332,7 @@ function sort (object, sortFunction) {
344332
}
345333

346334
function sortIdentifier (doclet) {
347-
var fieldOrder = [ 'id', 'parentId', 'longname', 'name', 'kind', 'scope', 'isExported', 'classdesc', 'augments', 'inherits', 'inherited', 'implements', 'overrides', 'mixes', 'description', 'memberof', 'alias', 'params', 'fires', 'examples', 'returns', 'type', 'defaultvalue', 'readonly', 'thisvalue', 'isEnum', 'properties', 'optional', 'nullable', 'variable', 'author', 'deprecated', 'ignore', 'access', 'requires', 'version', 'since', 'licenses', 'license', 'typicalname', 'category', 'see', 'exceptions', 'codeName', 'todoList', 'customTags', 'chainable', 'meta', 'order' ]
335+
var fieldOrder = ['id', 'parentId', 'longname', 'name', 'kind', 'scope', 'isExported', 'classdesc', 'augments', 'inherits', 'inherited', 'implements', 'overrides', 'mixes', 'description', 'memberof', 'alias', 'params', 'fires', 'examples', 'returns', 'type', 'defaultvalue', 'readonly', 'thisvalue', 'isEnum', 'properties', 'optional', 'nullable', 'variable', 'author', 'deprecated', 'ignore', 'access', 'requires', 'version', 'since', 'licenses', 'license', 'typicalname', 'category', 'see', 'exceptions', 'codeName', 'todoList', 'customTags', 'chainable', 'meta', 'order']
348336
return sort(doclet, function (a, b) {
349337
if (fieldOrder.indexOf(a) === -1 && fieldOrder.indexOf(b) > -1) {
350338
return 1
@@ -385,7 +373,9 @@ function fixES6ConstructorMemberLongnames (data) {
385373
const es6constructor = getEs6Constructor(data, i)
386374
if (es6constructor) {
387375
const constructorChildren = data.filter(where({ memberof: es6constructor.longname }))
388-
constructorChildren.forEach(child => child.memberof = i.longname)
376+
constructorChildren.forEach(child => {
377+
child.memberof = i.longname
378+
})
389379
}
390380
}
391381
})

0 commit comments

Comments
 (0)