Skip to content

Commit 563cfde

Browse files
committed
update deps, dates, linting, CI
1 parent ff28e97 commit 563cfde

5 files changed

Lines changed: 37 additions & 606 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
node-version: [12, 14, 16, 18, 19]
18+
node-version: [12, 14, 16, 18, 20, 21]
1919

2020
steps:
2121
- uses: actions/checkout@v2

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-23 Lloyd Brookes <75pound@gmail.com>
3+
Copyright (c) 2014-24 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ $ jsdoc2md --json <files>
2525

2626
* * *
2727

28-
&copy; 2014-23 Lloyd Brookes \<75pound@gmail.com\>.
28+
&copy; 2014-24 Lloyd Brookes \<75pound@gmail.com\>.
2929

3030
Tested by [test-runner](https://github.com/test-runner-js/test-runner). Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).

lib/transform.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ const arrayify = require('array-back')
44
const extract = require('reduce-extract')
55
const omit = require('lodash.omit')
66

7-
function pick(object, keys) {
7+
function pick (object, keys) {
88
return keys.reduce((obj, key) => {
9-
if (object && object.hasOwnProperty(key)) {
10-
obj[key] = object[key];
11-
}
12-
return obj;
13-
}, {});
9+
if (object && object.hasOwnProperty(key)) {
10+
obj[key] = object[key]
11+
}
12+
return obj
13+
}, {})
1414
}
1515

1616
/**
@@ -148,16 +148,16 @@ function createConstructor (class_) {
148148

149149
/* split each class found into two new items, then re-insert them over the original class */
150150
function insertConstructors (data) {
151-
var replacements = []
151+
const replacements = []
152152

153153
data.forEach(function (doclet, index) {
154154
if (doclet.kind === 'class') {
155-
replacements.push({ index: index, items: createConstructor(doclet) })
155+
replacements.push({ index, items: createConstructor(doclet) })
156156
}
157157
})
158158

159159
replacements.reverse().forEach(function (replacement) {
160-
var spliceArgs = [replacement.index, 1].concat(replacement.items)
160+
const spliceArgs = [replacement.index, 1].concat(replacement.items)
161161
data.splice.apply(data, spliceArgs)
162162
})
163163

@@ -188,7 +188,7 @@ function replaceID (id, oldID, newID) {
188188
}
189189

190190
function updateIDReferences (doclet, newID) {
191-
var oldID = newID.split('--')[0]
191+
const oldID = newID.split('--')[0]
192192
if (oldID && !doclet.isExported) {
193193
if (doclet.id) doclet.id = replaceID(doclet.id, oldID, newID)
194194
if (doclet.memberof) doclet.memberof = replaceID(doclet.memberof, oldID, newID)
@@ -258,11 +258,11 @@ function wantedProperties (input) {
258258
}
259259

260260
function buildTodoList (doclet) {
261-
var todoList = []
261+
let todoList = []
262262
if (doclet.todo) {
263-
var todo = arrayify(doclet.todo)
263+
const todo = arrayify(doclet.todo)
264264
todoList = todoList.concat(todo.map(function (task) {
265-
return { done: false, task: task }
265+
return { done: false, task }
266266
}))
267267
}
268268

@@ -271,7 +271,7 @@ function buildTodoList (doclet) {
271271
Combine @todo array with @done custom tags to make @todoList
272272
*/
273273
if (doclet.tags) {
274-
var done = doclet.tags.reduce(extract({ title: 'done' }), [])
274+
const done = doclet.tags.reduce(extract({ title: 'done' }), [])
275275
if (!doclet.tags.length) delete doclet.tags
276276
todoList = todoList.concat(done.map(function (task) {
277277
return { done: true, task: task.value }
@@ -286,23 +286,23 @@ function buildTodoList (doclet) {
286286

287287
function extractTypicalName (doclet) {
288288
if (doclet.tags) {
289-
var typicalName = doclet.tags.reduce(extract({ title: 'typicalname' }), [])
289+
const typicalName = doclet.tags.reduce(extract({ title: 'typicalname' }), [])
290290
if (typicalName.length) doclet.typicalname = typicalName[0].value
291291
}
292292
return doclet
293293
}
294294

295295
function extractCategory (doclet) {
296296
if (doclet.tags) {
297-
var category = doclet.tags.reduce(extract({ title: 'category' }), [])
297+
const category = doclet.tags.reduce(extract({ title: 'category' }), [])
298298
if (category.length) doclet.category = category[0].value
299299
}
300300
return doclet
301301
}
302302

303303
function extractChainable (doclet) {
304304
if (doclet.tags) {
305-
var chainable = doclet.tags.reduce(extract({ title: 'chainable' }), [])
305+
const chainable = doclet.tags.reduce(extract({ title: 'chainable' }), [])
306306
if (chainable.length) doclet.chainable = true
307307
}
308308
return doclet
@@ -329,8 +329,8 @@ function setTypedefScope (doclet) {
329329
}
330330

331331
function sort (object, sortFunction) {
332-
var output = {}
333-
var newPropertyOrder = Object.keys(object).filter(function (prop) {
332+
const output = {}
333+
const newPropertyOrder = Object.keys(object).filter(function (prop) {
334334
return typeof object[prop] !== 'function'
335335
}).sort(sortFunction)
336336
newPropertyOrder.forEach(function (prop) {
@@ -340,7 +340,7 @@ function sort (object, sortFunction) {
340340
}
341341

342342
function sortIdentifier (doclet) {
343-
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']
343+
const 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']
344344
return sort(doclet, function (a, b) {
345345
if (fieldOrder.indexOf(a) === -1 && fieldOrder.indexOf(b) > -1) {
346346
return 1
@@ -351,10 +351,10 @@ function sortIdentifier (doclet) {
351351
}
352352

353353
function update (array, query, newValues) {
354-
for (var i = 0; i < array.length; i++) {
354+
for (let i = 0; i < array.length; i++) {
355355
if (testValue(array[i], query)) {
356-
var values = typeof newValues === 'function' ? newValues(array[i]) : newValues
357-
for (var prop in values) {
356+
const values = typeof newValues === 'function' ? newValues(array[i]) : newValues
357+
for (const prop in values) {
358358
if (values[prop] !== undefined) array[i][prop] = values[prop]
359359
}
360360
}
@@ -401,7 +401,7 @@ function convertIsEnumFlagToKind (doclet) {
401401
/* remove properties which have enum parents.. depends on convertIsEnumFlagToKind */
402402
function removeEnumChildren (json) {
403403
return json.filter(function (doclet) {
404-
var parent = json.find(where({ id: doclet.memberof }))
404+
const parent = json.find(where({ id: doclet.memberof }))
405405
if (parent && parent.kind === 'enum') {
406406
return false
407407
} else {

0 commit comments

Comments
 (0)